How to Leverage Browser Caching via .htaccess

By using this code, our main static files (images, CSS, PDF’s, JS, etc.) will be cached in order to produce faster loading times in the future.

Leverage Browser Caching

 # enable expirations  
 <FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf|txt|html|x-html|php|css|xml|js|woff|ttf|svg|eot)(\.gz)?$">  
 <IfModule mod_expires.c>  
     ExpiresActive On  
 <IfModule mod_headers.c>  
 # expire GIF images after a month in the client's cache  
 ExpiresByType image/gif A2592000  
 # HTML documents are good for a week from the  
 # time they were changed  
 ExpiresByType text/html M604800  

Nikunj K

Phasellus facilisis convallis metus, ut imperdiet augue auctor nec. Duis at velit id augue lobortis porta. Sed varius, enim accumsan aliquam tincidunt, tortor urna vulputate quam, eget finibus urna est in augue.