Speed Up Magento Using .htaccess
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.
- Turn on apache mod_deflate by uncommenting (remove ‘#’) on the following:
# Insert filter on all content
# Insert filter on selected content types only
# 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 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:
ExpiresDefault "access plus 1 year"
Once you have completed these changes to .htaccess, re upload it to your server.