We’ll give you some lines of code to add to your .htaccess file and walk you through the whole process.

How to fix the message “Setting an expiry date or a maximum age in the HTTP headers for static resources instructs the browser to load previously downloaded resources from local disk rather than over the network”

Site load speed is important for two reasons: user experience and SEO.  Needless to say, with Google getting ready to reward and penalize mobile sites for their load times, it’s important to make sure that your site is as fast as it can be.  But you already know this.

So you’ve gotten this message…

Setting an expiry date or a maximum age in the HTTP headers

and you want to see this:

90 google page speed

Although you may think that doing this with a plugin would be easier, my experience has been that it is not easier.  WP Cache wouldn’t allow me to do this at all and W3 Total Cache ended up crashing my site, leading to several hours of trying to fix whatever it broke.  Ultimately, adding a script to my .htaccess file did the trick.

Log into your file manager on your hosting

You should see this screen at the root of the website that you are trying to work on:

find .htaccess

You are going to edit your .htaccess file by adding the following code:


ExpiresActive On
ExpiresDefault “access plus 10 days”
ExpiresByType text/css “access plus 1 week”
ExpiresByType text/plain “access plus 1 month”
ExpiresByType image/svg+xml “access 1 month”
ExpiresByType image/gif “access plus 1 month”
ExpiresByType image/png “access plus 1 month”
ExpiresByType image/jpeg “access plus 1 month”
ExpiresByType application/x-javascript “access plus 1 month”
ExpiresByType application/javascript “access plus 1 week”
ExpiresByType application/x-icon “access plus 1 year”


Save it and check that it worked

You should make sure that you saved the .htaccess file, then try PageSpeed insights.  There’s a good chance that you just hit the green!