SiteKickr Web Development

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