Leverage browser caching

If you’ve ever tried the Google Developers Audit or the Pingdom Speed test on your website then you’ve probably seen the warning about “Leverage browser caching“, it basicly means that the site tells the browser to keep some of the files cached for faster page loading.

You can do this with your local .htaccess file:

### Leverage Browser Caching 
# 2592000 = 30 Days
# 31536000 = 1 Year

<filesMatch ".(js|css)$">
Header set Cache-Control "max-age=2592000, public"

<filesMatch ".(jpg|jpeg|png|gif|ico)$">
Header set Cache-Control "max-age=31536000, public"

Leave a comment

Your email address will not be published.