Speed up your CRE Loaded store

We see it all the time.. slow loading CRE Loaded stores.. here are a few pieces of code that should speed up your site BIG TIME! In your root .htaccess file add this at the bottom (if you get a 500 internal server error, remove it as your host does not support it)

<IfModule mod_gzip.c>   
    mod_gzip_on         Yes   
    mod_gzip_dechunk    Yes   
    mod_gzip_item_include file          \.(html?|txt|css|js|php|pl)$   
    mod_gzip_item_include handler       ^cgi-script$   
    mod_gzip_item_include mime      ^text\.*   
    mod_gzip_item_include mime      ^application/x-javascript.*   
    mod_gzip_item_exclude mime      ^image\.*   
    mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*   
</IfModule> 
#cache html and htm files for one day   
<FilesMatch ".(html|htm)$">   
Header set Cache-Control "max-age=43200"  
</FilesMatch>   
  
#cache css, javascript and text files for one week   
<FilesMatch ".(js|css|txt)$">   
Header set Cache-Control "max-age=604800"  
</FilesMatch>   
  
#cache flash and images for one month   
<FilesMatch ".(flv|swf|ico|gif|jpg|jpeg|png)$">   
Header set Cache-Control "max-age=2592000"  
</FilesMatch>   
  
#disable cache for script files   
<FilesMatch "\.(pl|php|cgi|spl|scgi|fcgi)$">   
Header unset Cache-Control   
</FilesMatch>

No related posts.

About: Jason

this is my info, you can not have it

5 comments

  1. Kimmy says:

    Thanks. I added your code to my .htaccess and got the following speed increase:
    #This is without code rewrite for speed
    07/04/2011 15:44:59 – allprods.php (1.309s)
    07/04/2011 15:45:02 – product_info.php?products_id=576 (1.098s)
    07/04/2011 15:45:05 – shopping_cart.php?&products_id=576 (0.299s)
    07/04/2011 15:45:12 – order_checkout.php (2.409s)

    #This is with code rewrite for speed
    07/04/2011 15:48:24 – allprods.php (0.408s)
    07/04/2011 15:48:26 – product_info.php?products_id=576 (0.314s)
    07/04/2011 15:48:29 – shopping_cart.php?&products_id=576 (0.280s)
    07/04/2011 15:48:34 – order_checkout.php (2.210s)

    • Elvis says:

      Hi, I’m trying to implement this but have the following question:
      Which .htaccess should I use. My site is under a directory /libri/ should I place it under the /homedirectory/ or the subdirectory ?

      Thanks in advance,
      Elvis

      • Jason Miller says:

        if you only want the store optimized then put it in the libri/.htaccess file, otherwise place it in your sites public root .htaccess file

        • Elvis says:

          Thanks for the prompt reply.

          So even if my .httaccess under the public root folder has the following redirect?
          ——
          RewriteEngine on

          RewriteCond %{HTTP_HOST} ^shtepiaelibrit.com$ [OR]
          RewriteCond %{HTTP_HOST} ^www.shtepiaelibrit.com$
          RewriteRule ^/?$ “http\:\/\/www\.shtepiaelibrit\.com\/libri\/” [L,R=301]
          ———–

  2. Elvis says:

    I added it but I’m still getting crummy speeds, sometimes in excess of 10s, this is very frustrating, what can I do?

Leave a Reply