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?

1 Answer 1


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.

  • 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, 2013 at 22:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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