Use efficient cache lifetimes

Formerly Serve static assets with an efficient cache policy.

Cache lifetimes (also known as cache expiry or TTL - Time To Live) determine how long a browser should store and reuse downloaded resources before requesting them again from the server.

A long cache lifetime can speed up repeat visits to your page. Learn more about caching.

Understanding Use efficient cache lifetimes

When a visitor's browser requests a resource like an image, CSS file, or JavaScript file, the server can tell the browser how long to keep that resource cached locally. For any future visit or page view, the browser uses its saved copy instead of downloading it again from the network.

This is controlled through HTTP headers, specifically the Cache-Control header with directives like max-age.


How to improve it with WP Rocket

WP Rocket automatically configures Browser caching when activated:

  • WP Rocket adds rules to your .htaccess file that sets cache lifetimes for all static assets including images, CSS, JavaScript, fonts, and media files. This ensures optimal cache durations without any manual configuration.

Why you may still see the audit after using WP Rocket

WP Rocket's browser caching configuration should not cause issues. However:

  • .htaccess conflicts - If you have custom caching rules in your .htaccess file that conflict with WP Rocket's rules, they may override each other. Remove any manual cache-control directives you've added before activating WP Rocket to avoid conflicts.
  • Nginx users - WP Rocket cannot automatically modify nginx configuration files. You must manually add the nginx rules WP Rocket provides in your hosting control panel or server configuration. Without this step, browser caching won't be active on nginx servers. Please refer to this documentation: NGINX configuration for WP Rocket
  • External resources - WP Rocket can only control cache headers for files hosted on your domain. External resources from third-party domains (Google Analytics, Facebook Pixel, CDN-hosted libraries) are controlled by their providers.
  • Cloudflare - A setting in Cloudflare could be overriding our rules. Log in to Cloudflare and go to:  Caching > Browser cache expiration to check this. We recommend a value of 1 year to prevent warnings in GT Metrix etc. 
  • Other Caching Layers (e.g. Varnish, Proxy Caches) - The rules set in this configuration could be overriding ours. Ask your host if that's the case.

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