Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

If I run a Google Chrome audit on a site, it lists all CSS, PNG, JPG, JS files and even the main domain (i.e. www.example.com) under the heading:

Leverage browser caching

  • The following resources are explicitly non-cacheable. Consider making them cacheable if possible

Will the features in the .htaccess of the HTML5 boilerplate help to resolve this?

If not, how best to approach this?

share|improve this question
up vote 2 down vote accepted

Yes that HTML5 Boilerplate link does contain the .htaccess information to make it pass Leverage Browsing caching.

Basiclly to pass that you just to make your images, js, css cacheable. You don't need to use the boilerplate method as theres many othre ways such as using a CDN network with your files using a 2 week TTL setting.

Another snippet of code that will work with Apache looks like

ExpiresActive On
ExpiresDefault "access plus 1 seconds"
ExpiresByType text/html "access plus 1 seconds"
ExpiresByType image/x-icon "access plus 2592000 seconds"
ExpiresByType image/gif "access plus 2592000 seconds"
ExpiresByType image/jpeg "access plus 2592000 seconds"
ExpiresByType image/png "access plus 2592000 seconds"
ExpiresByType text/css "access plus 604800 seconds"
ExpiresByType text/javascript "access plus 86400 seconds"
ExpiresByType application/x-javascript "access plus 86400 seconds"

I recommend images 4 weeks since its not often your change these and 2 weeks for JS and 72 hours for CSS but its down to personally choice.

share|improve this answer
Great, thanks! Good suggestions and alternatives to HTML5 Boilerplate (but in my case I will stick with it and modify/optimize if need be) – Baumr Feb 26 '13 at 22:28

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.