Leverage-browser-cachingHave you seen this error in Google page speed? Leverage browser caching!! Here’s the fix

Browser caching of external resources can increase loading time of a web page and decrease server load.  In this article i will explain how to enable mod_expires  and to improve page speed as page speed is now 1 of Google’s many SEO factors.

Browser caching should be used for static resources such as pictures, css  and js files etc.

Googles overview of this is simple:

Setting an expiry date or a maximum age in the HTTP headers for static resources instructs the browser to load previously downloaded resources from local disk rather than over the network.

Enabling cache expiration can be done with the Apache module mod_expires, either with an entry in .htaccess or the server’s httpd.conf. Cache times need to be entered in seconds:

“Note that mod_expires should be loaded by default in the Apache already!”

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 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 2 days"

Then refresh the page and test again!

For those of you on shared hosting and free hosting, you will need to contact your hosting provider to do this for you! I’ve tested this will all major CMS scripts (Joomla, wordpress, Drupal) and all is fine!

Donations

If you like my FREE plugins, buy me a coffee

Newsletter

Subscribe to our email newsletter for useful tips and valuable resources.