Magento is one of the most flexible open-source e-commerce applications that comes with lots of desirable features for shopping-cart sites. However, due to these various functionalities, its performance can be a major issue.
Magento provides helpful resources in its blog and forum to improve performance including database tuning and server configuration modification. But in many cases, these performance enhancements should be done through system administrators of your hosting company or would work only when you have a dedicated server. Read more about Magento Performance Improvement.
An easier way to improve Magento website speed is to turn on GZip compression via .htaccess. GZip compression is a kind of technique to compress textual content when it’s transferred from the web server to a user’s browser.
A single web page from a Magento site can be a few hundreds KB -one of my site shows its homepage size is 500KB when Yahoo homepage is 200KB! (you can check this by clicking Information View Document Size from FireFox developer’s tool bar.)
GZip compression can reduce page size significantly and transfer the data faster to your site visitors.
The files that can be compressed are text files such as XHTML, JavaScript or CSS. Image, video or other multi media files are already compressed.
Find the section for “mod_deflate.c” from your .htaccess file and uncomment the settings as follows:
# Insert filter
SetOutputFilter DEFLATE
# 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
</IfModule>
php_flag zlib.output_compression on
Notes:
By osCommerce Templates, April 22, 2009 @ 8:01 pm
Thanks for this one. This will significantly help to those who have problems configuring the Magento including myself.
I have to agree that Magento is quite hard to configure if you are a first time user of the software.
By fred perry, February 19, 2010 @ 2:56 pm
Works like a charm. Its awesome thanks!
By Web Dizajn, March 5, 2010 @ 2:48 pm
Thanks, I believe this should be very helpful info!
By Mercool McCaber, March 14, 2010 @ 8:54 am
Thanks, this is a different way of looking at the magento speed problem, and some useful advice – I have to admit to not having looked at this despite gzip having come to my aid in the past with non-Magento problems. I agree that the automatically generated pages are quite verbose and in my case I would expect them to compress very well with noticeable improvements in response time. Thanks again for the advice, combined with the many other tricks I think my site should soon be very zippy (groan!) indeed!