Friday, May 16, 2014

Leverage Browser Caching

Web developer's have to take care all the aspects which keep a website fast and smart in every challenge. One can easily check the performance of his/her website from several testing tools, but how to overcome all those fixes notified by the tool ? 

OK let's start discussing about them, hope we can find a way out...

One of the common problem is Browser Caching, what it is ? Simple Question. Look, here is the answer :)
To display a website, browser needs to load several item's like website's logo, css file, and other necessary files. And browser doe's a simple task that it keeps in mind which files already been loaded so that it does not need to load these files again when an user visit's other pages of the site. Ultimately this task lets your website load faster.

How To Improve... go to your web host and open file manager open your .htaccess file and add the codes on top of that file. One thing! make sure you kept the original .htaccess file for backup, that means you are risk free :)



ExpiresActive On
ExpiresByType image/jpg "access 1 year"
ExpiresByType image/jpeg "access 1 year"
ExpiresByType image/gif "access 1 year"
ExpiresByType image/png "access 1 year"
ExpiresByType text/css "access 1 month"
ExpiresByType text/html "access 1 month"
ExpiresByType application/pdf "access 1 month"
ExpiresByType text/x-javascript "access 1 month"
ExpiresByType application/x-shockwave-flash "access 1 month"
ExpiresByType image/x-icon "access 1 year"
ExpiresDefault "access 1 month"


here is a report, just after modifying the .htaccess file with this code -

No comments:

Post a Comment