Leverage browser caching
- The following cacheable resources have a short freshness lifetime. Specify an expiration at least one week in the future for the following resources:
With a note of: (expiration not specified)
To deal with this, I added the following to my .htaccess file:
<FilesMatch "\.(ico|jpg|jpeg|png|gif|js|css|swf|woff|ICO|JPG|JPEG|PNG|GIF|JS|CSS|SWF|WOFF)$"> <IfModule mod_expires.c> ExpiresActive on ExpiresDefault "access plus 30 days" </IfModule> </FilesMatch>
This is a modified version of what I saw recommended. The original as I found it was:
<FilesMatch "\.(ico|jpg|jpeg|png|gif|js|css|swf)$"> <IfModule mod_expires.c> ExpiresActive on ExpiresDefault "access plus 30 days" </IfModule> Header unset ETag FileETag None </FilesMatch>
However I had a plugin that added the ‘Header unset ETag’ and ‘FileETag None’ lines. I found the code here, and you can read up on mod_expires here. It is good to note that although the message recommends at least 7 days, Google has a best practices guide found here that recommends 30 days as a minimum.