Browser caching in 60 seconds

There are a multitude of articles out there on browser caching. If you're using Apache as your web server and want to cut to the chase – implement browser caching on your static content (images, css, javascript) by dropping the code below into your httpd.conf or VirtualHost stanza:

ExpiresActive On
ExpiresByType image/gif A2592000
ExpiresByType image/png A2592000
ExpiresByType image/jpg A2592000
ExpiresByType image/jpeg A2592000
ExpiresByType text/css A2592000
ExpiresByType application/javascript A2592000
ExpiresByType application/x-javascript A2592000

This will instruct browsers to cache gif, png, jpeg, css and JavaScript content for 30 days.

If you want to understand more, check out the following articles:

Leverage Browser Caching

Caching Tutorial

Subscribe

  • RSS Feed for Posts


This entry was tagged , , , .

Updated: 2011-06-20

Phil LaNasa

Leave a Reply

Your email address will not be published. Required fields are marked *


*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <font color="" face="" size=""> <span style="">