Using these settings, I reduced my GTmetrix scores as follows:
Page Load Time: 21.09s > 4.6s
Total page size: 1.37MB > 585KB
Total number of requests: 99 > 85
UPDATE 30/01/13: htaccess optimisations and SmartOptimizer optimisations
First of all, very basic. Ensure your admin control panel has the 'Development Mode' link in the bottom-right corner. If the link says 'Live Mode', this means your store is running in Development Mode and vice versa.
In config.local.php:
$config['tweaks'] = array ( 'js_compression' => true, // enables compession to reduce size of javascript files 'check_templates' => false, // disables templates checking to improve template engine speed 'inline_compilation' => true, // compiles nested templates in one file 'anti_csrf' => false, // protect forms from CSRF attacks 'disable_block_cache' => true, // used to disable block cache 'join_css' => true, // is used to unite css files into one file 'allow_php_in_templates' => false, // Allow to use {php} tags in templates 'disable_localizations' => true, // Disable Localizations functionality 'disable_google_base' => true, //Disable obsolete google base functionality );
In store root .htaccess
DirectoryIndex index.html index.php <IfModule mod_rewrite.c> RewriteEngine on # Pleas 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 / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . index.php?sef_rewrite=1 [L,QSA] </IfModule> <IfModule mod_expires.c> <FilesMatch "\.(ico|gif|jpg|jpeg|png|swf|css|js|html?|xml|txt)$"> ExpiresActive On ExpiresDefault "access plus 10 years" </FilesMatch> </IfModule> <IfModule mod_headers.c> <FilesMatch \.(css|js)$> Header append Vary User-Agent Header append Vary Accept-Encoding Header append Cache-Control public </FilesMatch> <FilesMatch \.(bmp|png|gif|jpe?g|ico|flv|wmv|asf|asx|wma|wax|wmx|wm|swf|pdf|doc|rtf|xls|ppt|eot|ttf|otf|svg)$> Header append Cache-Control public </FilesMatch> <FilesMatch \.(js|css|bmp|png|gif|jpe?g|ico|flv|wmv|asf|asx|wma|wax|wmx|wm|swf|pdf|doc|rtf|xls|ppt)$> Header unset ETag FileETag None </FilesMatch> </IfModule> # Turn on Expires and set default to 0 <IfModule mod_expires.c> ExpiresActive On <FilesMatch \.css$> ExpiresDefault "access plus 10 years" </FilesMatch> ExpiresByType text/css A315360000 <FilesMatch \.js$> ExpiresDefault "access plus 10 years" </FilesMatch> ExpiresByType text/javascript A315360000 ExpiresByType application/javascript A315360000 ExpiresByType application/x-javascript A315360000 ExpiresByType text/x-js A315360000 ExpiresByType text/ecmascript A315360000 ExpiresByType application/ecmascript A315360000 ExpiresByType text/vbscript A315360000 ExpiresByType text/fluffscript A315360000 <FilesMatch \.(bmp|png|gif|jpe?g|ico)$> ExpiresDefault "access plus 10 years" </FilesMatch> ExpiresByType image/gif A315360000 ExpiresByType image/png A315360000 ExpiresByType image/jpeg A315360000 ExpiresByType image/x-icon A315360000 ExpiresByType image/bmp A315360000 <FilesMatch \.(eot|ttf|otf|svg)$> ExpiresDefault "access plus 10 years" </FilesMatch> ExpiresByType application/x-font-opentype A315360000 ExpiresByType application/x-font-truetype A315360000 ExpiresByType application/x-font-ttf A315360000 ExpiresByType application/x-font A315360000 ExpiresByType font/opentype A315360000 ExpiresByType font/otf A315360000 ExpiresByType application/vnd.oasis.opendocument.formula-template A315360000 ExpiresByType image/svg+xml A315360000 ExpiresByType application/vnd.ms-fontobject A315360000 ExpiresByType font/woff A315360000 <FilesMatch \.(flv|wmv|asf|asx|wma|wax|wmx|wm)$> ExpiresDefault "access plus 10 years" </FilesMatch> ExpiresByType video/x-flv A315360000 ExpiresByType video/x-ms-wmv A315360000 ExpiresByType video/x-ms-asf A315360000 ExpiresByType video/x-ms-asx A315360000 ExpiresByType video/x-ms-wma A315360000 ExpiresByType video/x-ms-wax A315360000 ExpiresByType video/x-ms-wmx A315360000 ExpiresByType video/x-ms-wm A315360000 <FilesMatch \.(swf|pdf|doc|rtf|xls|ppt)$> ExpiresDefault "access plus 10 years" </FilesMatch> ExpiresByType application/x-shockwave-flash A315360000 ExpiresByType application/pdf A315360000 </IfModule> FileETag none <IfModule mod_deflate.c> <FilesMatch "\.(php|html)$"> SetOutputFilter DEFLATE </FilesMatch> </IfModule>
Install a PHP Compression Engine:
Download and install SmartOptimizer, follow the instructions in the SmartOptimizer download file to install. Basically, upload the 'smartoptimizer' folder to the root of your hosting, and set the permissions of /smartoptimizer/cache/ to '777'. If you do decide to also use Smart Optimizer, add the following to the .htaccess file in the root of your store:
<IfModule !mod_expires.c> RewriteCond %{REQUEST_FILENAME} -f RewriteRule ^(.*\.(ico|gif|jpg|jpeg|png|swf|css|js|html?|xml|txt|pdf))$ smartoptimizer/?$1 </IfModule> RewriteRule ^(.*\.(js|css))$ smartoptimizer/?$1
If you use any 'social' or Chat plugins, such as AddThis, ShareThis, LiveChat, Twitter, Facebook, etc, or an image banner scroller, which require JavaScript, I would advise you edit your relevent template files and add the 'defer async' tag on the <script src> tag for JavaScript, like so:
<script type="text/javascript" defer async src="js/easySlider1.7.js"></script>
Note: These steps are for an Apache server. Suitable for CS-Cart Version 3. May work on previous versions of the cart but config.local.php does differ slightly in version 2.
There are various other elements you could change to speed up your site, but most of these other changes are on a site-specific basis.
I achieved the speed increase as previously mentioned with only these changes, with various further changes, I reduced the page load time to under 3 seconds, with a file size of 450kb and 78 requests. These simple steps will hopefully help speed up your site too.
If you have any other tips or suggestions, please feel free to contribute to this thread.