Leverage Browser Caching to Improve Website Speed

Since Google has introduced website speed as a ranking factor, it is very important to ensure that tweaks are made to reduce the loading speed of your website. If you are using Firefox, you can install Firebug with the Page Speed addon to monitor the elements on your website that need improvement. If you haven’t done it already, browser caching will definitely be one of them!

Browser Caching

If you set an expiry date or a maximum age in the HTTP headers for static resources (such as: images, css, javascript, pdf, swf etc.), modern browsers will load previously downloaded static resources from local disks rather than over the network.

So if you configure your web server to set caching headers and apply them to all cacheable static resources, your site will appear to load quicker.

This solution only applies to servers running Apache. For a Windows server solution look here.

To enable browser caching you must have access to your .htaccess file. Download the .htaccess from the root of your domain and open it in a text editor (such as Notepad) and add the following code:

ExpiresActive on
ExpiresDefault "access plus 30 days"

Header unset ETag
FileETag None

AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css application/javascript application/x-javascript application/rss+xml application/atom_xml text/javascript

Depending on your server setup you may get a 500 error. Alternatively you can use this code:

## EXPIRES CACHING ##

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"
## EXPIRES CACHING ##
Free Graphics, Icons, Tutorials
Free Graphics Free Christmas Vector Icon Graphics Pack 2017Free Fitness Vector Icons Graphics PackFree Camping Vector Graphics PackFree Summer Graphics PackFree File Icon PackFree Fast Food Vector Graphics
Sharing is caring...
Like & Follow
Share the love, share this page! Facebook Twitter Google Digg Reddit LinkedIn Pinterest Email
Close [X]
The Web Taylor
1000 Lakeside North Harbour Portsmouth, Hampshire PO6 3EN
02392 123358