Serve static assets with an efficient cache policy

This recommendation refers to browser caching and for how long the browser should keep your static files in its cache for better performance.

As we explain in this article, browser caching is a feature that allows you to speed up your website for those visitors who visit multiple pages, or visit multiple times, by storing files locally in the user’s browser; this way the user’s browser doesn’t need to re-download the files from your server on each visit, making the loading time of returning visits much faster.

Cache policy, on the other hand, refers to the instruction with which the site’s server indicates the user’s browser for how long these files should be kept by it, i.e., it sets their expiration time.

The current expiration time of each file can be checked using the browser’s developer tools under the Cache-Control column:

Note that Cache-Control displays the cache length in seconds, so it won't correspond to what you will see in PageSpeed Insight’s recommendation. You can use Epochconverter to easily convert this value to days or months (see section Convert seconds to days, hours and minutes).

How WP Rocket can help

WP Rocket sets the optimal expiration lengths for certain types of files by adding some rules via the .htaccess file (more info).

If you see different expiration times for these files, or if PageSpeed states the Cache TTL is “none”, you can find some possible reasons for the rules not being applied here:

Troubleshooting "Leverage browser caching" warnings

Alternatively, you may need to check with your hosting provider if they have some settings for this that could be overriding ours. 

Heads up! The expires headers for external resources, i.e. those served from 3rd-party servers can only be defined by their owners. See: Handling external resources 

More information:

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.