Speed up Magento using .htaccess

Peter .

Here at Nimbus, we LOVE Magento. We’ve found some hidden gems in Magento’s default .htaccess that you can utilise to get your site running even faster on your hosting with us.

You’ll need to access your .htaccess file in the root of your web docs via FTP. Once you have a copy,  save a backup of the old .htaccess and make the following changes.

Apache mod_deflate compresses text, css and Javascript on your site. It essentially reduces the size of data that a browser needs to download to display your site.

  • Turn on apache mod_deflate by uncommenting (remove ‘#’) on the following:
# 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 application/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


Expires – These are code that determines how long to cache elements of your site. 

  • Enable Expires on Headers by uncommenting (remove ‘#’) on the following and add:
ExpiresActive On
ExpiresDefault "access plus 1 year"


Once you have completed these changes to .htaccess, re upload it to your server.

Nimbus Hosting
1 Centrus, Mead Lane Hertford Hertfordshire SG13 7GX GB 0203 005 9181 [email protected]