Showing posts with label remove caching. Show all posts
Showing posts with label remove caching. Show all posts

Saturday, July 21, 2012

Page speed up using .htaccess

  • How to remove caching from your files. For a particular folder, you might require to remove the caching, So, you can use the following in your .htaccess to remove the cache.

         
                FileETag None
               
                Header unset ETag
                Header set Cache-Control "max-age=0, no-cache, no-store, must-revalidate"
                Header set Pragma "no-cache"
                Header set Expires "Wed, 11 Jan 1984 05:00:00 GMT"
               

           


  • To add expire date for your files the below code in .htaccess would help you

           
                ExpiresActive On
                ExpiresDefault A86400
                ExpiresByType image/x-icon A2419200
                ExpiresByType image/gif A604800
                ExpiresByType image/png A604800
                ExpiresByType image/jpeg A604800
                ExpiresByType text/css A604800
                ExpiresByType application/x-javascript A604800
                ExpiresByType text/plain A604800
                ExpiresByType application/x-shockwave-flash A604800
                ExpiresByType application/pdf A604800
                ExpiresByType text/html A900
           


  • To enable the gziping the file, below code in htaccess would help you
          AddOutputFilterByType DEFLATE text/html text/xml text/css text/javascript

  •  To make the htm files to work as php files, where you can add php code in html file, you can use below code in htaccess and work on it
           AddType application/x-httpd-php .htm