Apache files compression is the fastest way to improve your Magento website speed and performance.

It is recommended to check compression status before and after compression activation. You can easily check compression and data savings level using http://www.whatsmyip.org/http-compression-test/ online service.

Here is a real example of what you can achieve with Apache files/traffic compression:

http://demo.magentocommerce.com/ is gzipped
Original Size: 24.66 KB
Gzipped Size: 5.84 KB
Data Savings: 76.32%

 

As you see Magento demo is optimized for speed using this feature.
To enable Apache served files compression mechanism, you need to open .htacess file of your Magento. Find this code in .htaccess file:

 

############################################
## 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

 

And replace it with this code:

 

############################################
## 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

 

Make sure that the ExpiresDefault "access plus 1 year" is not commented in .htaccess of your Magento installation:

 


############################################
## Add default Expires header
## http://developer.yahoo.com/performance/rules.html#expires

ExpiresDefault "access plus 1 year"

 

Also, check if the php_flag zlib.output_compression on command is also enabled in .htaccess file:

 

############################################
## enable resulting html compression

php_flag zlib.output_compression on

 

Save .htaccess file and check speed performance and compression level (using http://www.whatsmyip.org/http_compression/ service) of your Magento pages.

Your Magento pages load speed will be faster from now.