Here is a quick rundown of some simple yet very effective file changes to speed up your CS-Cart Version 3 stores.
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
[color=#006400]UPDATE 30/01/13: [/color][color=#006400]htaccess optimisations and SmartOptimizer optimisations[/color]
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
```php
DirectoryIndex index.html index.php
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]
ExpiresActive On
ExpiresDefault “access plus 10 years”
Header append Vary User-Agent
Header append Vary Accept-Encoding
Header append Cache-Control public
Header append Cache-Control public
Header unset ETag
FileETag None
Turn on Expires and set default to 0
ExpiresActive On
ExpiresDefault “access plus 10 years”
ExpiresByType text/css A315360000
ExpiresDefault “access plus 10 years”
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
ExpiresDefault “access plus 10 years”
ExpiresByType image/gif A315360000
ExpiresByType image/png A315360000
ExpiresByType image/jpeg A315360000
ExpiresByType image/x-icon A315360000
ExpiresByType image/bmp A315360000
ExpiresDefault “access plus 10 years”
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
ExpiresDefault “access plus 10 years”
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
ExpiresDefault “access plus 10 years”
ExpiresByType application/x-shockwave-flash A315360000
ExpiresByType application/pdf A315360000
FileETag none
SetOutputFilter DEFLATE
```
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:
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^(.*\.(ico|gif|jpg|jpeg|png|swf|css|js|html?|xml|txt|pdf))$ smartoptimizer/?$1
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
```
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.