How to Leverage Browser Caching via .htaccess

Share:
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>  
 <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  
 </IfModule>  
 </FilesMatch>  

No comments

'; (function() { var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true; dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js'; (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq); })();

Ads