Magento gzip Compression: Boost speed of your Magento Store

The biggest drawback with Magento is its speed with the default settings. Nowadays there are plugins available by which you can boost speed of your magento store and also you can enable caching from the admin but, here I am going to share a technique with you which will take the store’s speed from fast to faster. It will be a great enhancement for your speedup extension and cache management. You can feel the noticeable increase in the speed of the Magento store immediately. The solution is enabling gzip compression in your store’s .htaccess file. A small change in it and your store will be much faster than before. Research shows that this technique increases the store speed up to 235%! So let’s get started in speeding up your Magento store.

Open your .htaccess file and search for the code given below:

############################################
## enable apache served files compression
## http://developer.yahoo.com/performance/rules.html#gzip
# Insert filter on all content
SetOutputFilter DEFLATE
# Insert filter on selected content types only
#AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript
# Netscape 4.x has some problems...
BrowserMatch ^Mozilla/4 gzip-only-text/html
# Netscape 4.06-4.08 have some more problems
BrowserMatch ^Mozilla/4\.0[678] no-gzip
# MSIE masquerades as Netscape, but it is fine
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
# Don't compress images
SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip dont-vary
# Make sure proxies don't deliver the wrong content
Header append Vary User-Agent env=!dont-vary
# enable resulting html compression
# For security reasons, mod_php is not used on this server. Use a php.ini file for php directives
# php_flag zlib.output_compression on

Remove the Comment from the code as shown in the following snippet of code or you can just replace the code in your .htaccess file with the code given below:

############################################
## enable apache served files compression
## http://developer.yahoo.com/performance/rules.html#gzip
# Insert filter on all content
SetOutputFilter DEFLATE
# Insert filter on selected content types only
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript
# Netscape 4.x has some problems...
BrowserMatch ^Mozilla/4 gzip-only-text/html
# Netscape 4.06-4.08 have some more problems
BrowserMatch ^Mozilla/4\.0[678] no-gzip
# MSIE masquerades as Netscape, but it is fine
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
# Don't compress images
SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip dont-vary
# Make sure proxies don't deliver the wrong content
Header append Vary User-Agent env=!dont-vary
# enable resulting html compression
# For security reasons, mod_php is not used on this server. Use a php.ini file for php directives
php_flag zlib.output_compression on

At last save your file, clear your cache and run your store faster than before.
If you have any questions or even more cool tricks or techniques drop me a line and I’ll return the favor for sure.