Magento Optimized htaccess

                                  Magento Optimized htaccess


The following htaccess entries are the optimized htaccess for a Magento, it will speedup your site upto 20%.
I have tested this htaccess in few sites and i have found that the speed of the site increased by 20%. You can also view the performance of your site after adding this site using the following link.

https://developers.google.com/speed/pagespeed/insights/

Feel the difference and optimize your site easily just by adding this, If you are getting more than 80% for your site in the above page speed test, it a good result.


########################################################################

## enable apache served files compression (not php, html/images/css/js

## http://developer.yahoo.com/performance/rules.html#gzip

<IfModule mod_deflate.c>

          # 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

</IfModule>

###################################################################

## Enable keep-alives to reduce # http requests

<ifModule mod_headers.c>

            Header set Connection keep-alive

</ifModule>

###################################################################

## Add default Expires header

## http://developer.yahoo.com/performance/rules.html#expires

<IfModule mod_expires.c>

# Turn on Expires and set default to 0

            ExpiresActive On

            ExpiresDefault A0

            # Set up caching on media files for 1 year (forever?)

            ExpiresDefault A29030400

            Header append Cache-Control "public"

            # Set up caching on media files for 2 weeks

            ExpiresDefault A1209600

            Header append Cache-Control "public"

            # Set up 1 week caching on commonly updated files

            ExpiresDefault A604800

            Header append Cache-Control "proxy-revalidate"

            # Force no caching for dynamic files

            ExpiresActive Off

            Header set Cache-Control "private, no-cache, no-store, proxy-revalidate, no-transform"

            Header set Pragma "no-cache"

</IfModule>

Header unset Pragma
Header unset ETag
FileETag None

##############################################################################


Hope this helped....

This entry was posted by Unknown. Bookmark the permalink.

23 thoughts on “Magento Optimized htaccess”

  1. Attend The Python Training in Bangalore From ExcelR. Practical Python Training in Bangalore Sessions With Assured Placement Support From Experienced Faculty. ExcelR Offers The Python Training in Bangalore.