Which Javascript File Can You Compress Without Breaking The Code

Even after an upgrade to 10 Gb assigned to my CS Cart VPS, upgrade to PHP 5.6, enabled / installed and configured XCache and Redis - still a sluggish page loading result.

Horrible in my opinion, even worse than a standard Magento install.

[attachment=11042:gtmetrix-results-pasioonline.png]

Disabled Google Analytics, disabled the external O Lark chat messenger, optimized images according to suggestions made by GT Metrix and Google Pagespeed Insight.

What else to do ?

DirectoryIndex index.html index.php

	# Compress HTML, CSS, JavaScript, Text, XML, fonts
	AddOutputFilterByType DEFLATE application/javascript application/x-javascript text/javascript application/json
	AddOutputFilterByType DEFLATE application/x-font application/x-font-opentype application/x-font-otf application/x-font-truetype application/x-font-ttf font/opentype font/otf font/ttf application/x-woff application/x-font-woff
	AddOutputFilterByType DEFLATE text/css text/html text/plain

	# Remove browser bugs (only needed for really old browsers)
	BrowserMatch ^Mozilla/4 gzip-only-text/html
	BrowserMatch ^Mozilla/4\.0[678] no-gzip
	BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
	Header append Vary User-Agent

Header set Access-Control-Allow-Origin "*"

Cache Static Searchanise

ExpiresByType http://static.searchanise.com/preload_data.8K5u9p6s3X.js “access plus 1 month”
ExpiresByType http://static.searchanise.com/styles.8K5u9p6s3X.css “access plus 1 month”
ExpiresByType http://static.searchanise.com/templates.8K5u9p6s3X.js “access plus 1 month”

RewriteEngine On
Header set Cache-Control “max-age=86400”
RewriteRule ^js/analytics.js http://www.google-analytics.com/analytics.js [P]

ExpiresByType http://static.searchanise.com/preload_data.2g6h9i2C9a.js “access plus 1 month”
ExpiresByType http://static.searchanise.com/styles.2g6h9i2C9a.css “access plus 1 month”
ExpiresByType http://static.searchanise.com/templates.2g6h9i2C9a.js “access plus 1 month”

End of Cache Static Searchanise

Cache all images for 2 months

ExpiresActive on ExpiresDefault "access plus 2 months" Header set Cache-Control "max-age=1209600"

#Expire Header

ExpiresDefault “access plus 2 months”

#Gzip

AddOutputFilterByType DEFLATE text/text text/html text/plain text/xml text/css application/x-javascript application/javascript

RewriteEngine on # Please note that RewriteBase setting is obsolete use it only in case you experience some problems with SEO addon. # Some hostings require RewriteBase to be uncommented # Example: # Your store url is http://www.yourcompany.com/store/cart # So "RewriteBase" should be: # RewriteBase /store/cart # RewriteBase / Options -MultiViews

RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

RewriteCond %{REQUEST_URI} ^api/(.)$ [or]
RewriteCond %{REQUEST_URI} .
/api/(.*)$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .api/(.)$ api.php?_d=$1 [L,QSA]

RewriteCond %{REQUEST_URI} .(png|gif|ico|swf|jpe?g|js|css|ttf|svg|eot|woff|yml|xml)$ [or]
RewriteCond %{REQUEST_URI} store_closed.html$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.?)/(.)$ $2 [L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php [L,QSA]

This prevents possible problems when downloading files

php_flag zlib.output_compression Off Header append Vary: Accept-Encoding Header unset ETag FileETag None ExpiresActive On ExpiresDefault "access plus 1 month" ExpiresByType text/html "access plus 2 months" ExpiresByType image/x-icon "access plus 1 year" Header unset ETag FileETag None ExpiresActive On ExpiresDefault "access plus 1 year" ForceType text/css Header set Content-Encoding: gzip Header set Cache-control: private Header unset ETag FileETag None ExpiresActive On ExpiresDefault "access plus 1 year" ForceType text/javascript Header set Content-Encoding: gzip Header set Cache-control: private Header set Access-Control-Allow-Origin "*"

ServerSignature Off

ExpiresActive on
ExpiresDefault                                      "access plus 1 month"

CSS

ExpiresByType text/css                              "access plus 1 year"

Data interchange

ExpiresByType application/atom+xml                  "access plus 1 hour"
ExpiresByType application/rdf+xml                   "access plus 1 hour"
ExpiresByType application/rss+xml                   "access plus 1 hour"

ExpiresByType application/json                      "access plus 0 seconds"
ExpiresByType application/ld+json                   "access plus 0 seconds"
ExpiresByType application/schema+json               "access plus 0 seconds"
ExpiresByType application/vnd.geo+json              "access plus 0 seconds"
ExpiresByType application/xml                       "access plus 0 seconds"
ExpiresByType text/xml                              "access plus 0 seconds"

Favicon (cannot be renamed!) and cursor images

ExpiresByType image/vnd.microsoft.icon              "access plus 1 month"
ExpiresByType image/x-icon                          "access plus 1 month"

HTML

ExpiresByType text/html                             "access plus 0 seconds"

JavaScript

ExpiresByType application/javascript                "access plus 1 year"
ExpiresByType application/x-javascript              "access plus 1 year"
ExpiresByType text/javascript                       "access plus 1 year"

Manifest files

ExpiresByType application/manifest+json             "access plus 1 week"
ExpiresByType application/x-web-app-manifest+json   "access plus 0 seconds"
ExpiresByType text/cache-manifest                   "access plus 0 seconds"

Media files

ExpiresByType audio/ogg                             "access plus 1 month"
ExpiresByType image/bmp                             "access plus 1 month"
ExpiresByType image/gif                             "access plus 1 month"
ExpiresByType image/jpeg                            "access plus 1 month"
ExpiresByType image/png                             "access plus 1 month"
ExpiresByType image/svg+xml                         "access plus 1 month"
ExpiresByType image/webp                            "access plus 1 month"
ExpiresByType video/mp4                             "access plus 1 month"
ExpiresByType video/ogg                             "access plus 1 month"
ExpiresByType video/webm                            "access plus 1 month"

Web fonts

# Embedded OpenType (EOT)
ExpiresByType application/vnd.ms-fontobject         "access plus 1 month"
ExpiresByType font/eot                              "access plus 1 month"

# OpenType
ExpiresByType font/opentype                         "access plus 1 month"

# TrueType
ExpiresByType application/x-font-ttf                "access plus 1 month"

# Web Open Font Format (WOFF) 1.0
ExpiresByType application/font-woff                 "access plus 1 month"
ExpiresByType application/x-font-woff               "access plus 1 month"
ExpiresByType font/woff                             "access plus 1 month"

# Web Open Font Format (WOFF) 2.0
ExpiresByType application/font-woff2                "access plus 1 month"

Other

ExpiresByType text/x-cross-domain-policy            "access plus 1 week"

#get rid of bad bots
RewriteEngine on
RewriteCond %{HTTP_USER_AGENT} ^BadBot [OR]
RewriteCond %{HTTP_USER_AGENT} ^EvilScraper [OR]
RewriteCond %{HTTP_USER_AGENT} ^FakeUser
RewriteRule ^(.*)$ http://rijksoverheid.nl/


order allow,deny
allow from all

deny from 145.12.37.107
deny from 145.12.37.103
deny from 145.12.37.0/24
deny from 145.12.37.103/25
deny from 138.199.64.230
deny from 139.0.0.0/16
deny from 178.22.84.0/22
deny from 145.12.0.0/16
deny from 145.12.0.0
deny from 178.22.85.0/24
deny from 31.3.98.252

RewriteCond %{REMOTE_ADDR} ^(?:85.159.97.1)$
RewriteRule ^(.*)$ http://www.timtales.com/$1 [R=301,NC]

RewriteCond %{REMOTE_ADDR} ^(?:85.159.98.33)$
RewriteRule ^(.*)$ http://www.youporn.com/$1 [R=301,NC]

RewriteCond %{REMOTE_ADDR} ^(?:145.12.0.0|145.12.37.255)$
RewriteRule ^(.*)$ http://www.timtales.com/$1 [R=301,NC]
deny from 151.11.201.3
deny from 151.11.0.0/16

RewriteRule ^(includes/|submit.php) - [F,L,NC]

deny from 107.150.51.210
deny from 146.0.231.50
deny from 212.7.220.13
deny from 69.30.200.34
deny from 69.30.232.50
deny from 69.197.185.186
deny from 69.30.196.218
deny from 212.7.220.14/31
deny from 212.7.220.16/28
deny from 212.7.220.32/27
deny from 212.7.220.64/26
deny from 212.7.220.128/25
deny from 212.7.221.0/24
deny from 212.7.222.0/23
deny from 212.7.224.0/19
deny from 61.160.247.107
deny from 107.150.37.40/29
deny from 107.150.37.48/28
deny from 107.150.37.64/28
deny from 107.150.37.80/31
deny from 107.150.37.82
deny from 107.150.51.10/31
deny from 107.150.51.12/30
deny from 107.150.51.16/28
deny from 107.150.51.32/27
deny from 107.150.51.64/26
deny from 107.150.51.128/26
deny from 107.150.51.192/28
deny from 107.150.51.208/31
deny from 212.7.194.28
deny from 212.7.217.2
deny from 212.7.220.16/30
deny from 212.7.220.20/31
deny from 212.7.220.22
deny from 37.57.231.239
deny from 69.30.202.34
deny from 69.30.227.50
deny from 69.30.231.50/31
deny from 69.30.231.52/30
deny from 69.30.231.56/31
deny from 69.30.231.58
deny from 78.138.97.90
deny from 85.195.114.93
deny from 192.151.144.218

Yes i placed a few redirects from IP of certain visitors to some adult entertainment site.

gtmetrix-results-pasioonline.png

How is it with the default .htaccess? The default file already covers deflate, headers and expires and you have added even more.

How is it with the default .htaccess? The default file already covers deflate, headers and expires and you have added even more.

I have to admit that I do not have the original anymore of this install but for all intent I tried the one from a recent CS Cart test bed install. Not much of an improvement at all.

What does GT show as slow loading?

I'm using PHP7, OPCache with fastcgi/php-fpm and default file for backend with good results.

What does GT show as slow loading?

I'm using PHP7, OPCache with fastcgi/php-fpm and default file for backend with good results.

GT shows that my Page Load Time is 3 sec above average, in betwee 9.1 and 11 sec.

Y Slow score is around 79 without the chat function (O'Lark) and with 74 at best.

Usually it has to do with fewer HTTP requests and Add Expire headers.

I run PHP 5.6 Apache 2.4 on a CentOS VM with Cpanel.

Run XCache which is not compatible with OPCache, you have to disalbe XCache in other to use OPCache.

What do you suggest ? Just upgrade PHP 5.6 to 7.0 ?

I had a look at your sites and there isn't much you can improve on as far as CSC. If you look at the waterfall, the first byte is taking forever which means it's your server configuration. I would also go with the default .htacess file if you haven't already.

I see you're on 4.3.3 so I would stay with PHP5.6.

4.3.3 /.htaccess

DirectoryIndex index.html index.php

    # Compress HTML, CSS, JavaScript, Text, XML, fonts
    AddOutputFilterByType DEFLATE application/javascript application/x-javascript text/javascript application/json
    AddOutputFilterByType DEFLATE application/x-font application/x-font-opentype application/x-font-otf application/x-font-truetype application/x-font-ttf font/opentype font/otf font/ttf application/x-woff application/x-font-woff
    AddOutputFilterByType DEFLATE text/css text/html text/plain

    # Remove browser bugs (only needed for really old browsers)
    BrowserMatch ^Mozilla/4 gzip-only-text/html
    BrowserMatch ^Mozilla/4\.0[678] no-gzip
    BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
    Header append Vary User-Agent

Header set Access-Control-Allow-Origin "*"

Cache all images for 2 weeks

ExpiresActive on ExpiresDefault "access plus 2 weeks" Header set Cache-Control "max-age=1209600" RewriteEngine on # Please note that RewriteBase setting is obsolete use it only in case you experience some problems with SEO addon. # Some hostings require RewriteBase to be uncommented # Example: # Your store url is http://www.yourcompany.com/store/cart # So "RewriteBase" should be: # RewriteBase /store/cart # RewriteBase / Options -MultiViews

RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

RewriteCond %{REQUEST_URI} ^api/(.)$ [or]
RewriteCond %{REQUEST_URI} .
/api/(.*)$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .api/(.)$ api.php?_d=$1 [L,QSA]

RewriteCond %{REQUEST_URI} .(png|gif|ico|swf|jpe?g|js|css|ttf|svg|eot|woff|yml|xml)$ [or]
RewriteCond %{REQUEST_URI} store_closed.html$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.?)/(.)$ $2 [L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php [L,QSA]

This prevents possible problems when downloading files

php_flag zlib.output_compression Off

I had a look at your sites and there isn't much you can improve on as far as CSC. If you look at the waterfall, the first byte is taking forever which means it's your server configuration. I would also go with the default .htacess file if you haven't already.

Well I went with the original default htaccess file already but that did not do any good. Have you got any idea where to look for that slow response in the first 6.31 sec ?

Not without knowing exactly how your server is configured.

Not without knowing exactly how your server is configured.

Are you expert on configuring Cpanel servers or do you know someone who is and you can recommend ?

At any rate I contacted CPanel and what they concluded was that the Apache response was sluggish due to the

Xcache and suPHP were both enabled and that caused the problem.

I am now on a Page Loading Speed of 4.7 sec.

That is still not as good as the 2.8 sec for a competitor of ours with a Magento store but a whole lot better than before.

Cheers

Are you expert on configuring Cpanel servers or do you know someone who is and you can recommend ?

I wouldn't say I was an "expert" but I went through a lot of trial and error to get my server running nicely.

At any rate I contacted CPanel and what they concluded was that the Apache response was sluggish due to the

Xcache and suPHP were both enabled and that caused the problem.

I am now on a Page Loading Speed of 4.7 sec.

That is still not as good as the 2.8 sec for a competitor of ours with a Magento store but a whole lot better than before.

Cheers

Glad to hear. I never tried XCache with SuPhp in my trial and error.