How to set long cache lifetimes for static files
Images, fonts, CSS and scripts rarely change. Telling browsers to keep them for a year makes every repeat visit faster.
Step by step, with screenshots: Cache-Control for humans: what to cache, how long, how to bust it →
Check your own site
Runs this check and the other 186, free, in about 45 seconds.
What a passing site looks like
- Static files have long cache lifetimeswarning · −2 ptseffort S
Static file caching
Why it matters. Images, fonts, CSS and JS rarely change, yet without a long Cache-Control lifetime returning visitors download them again on every page.
- Set Cache-Control max-age of a year on versioned static files (most CDNs and caching plugins have a "browser caching" switch).
- Add a version or hash to file names so you can still change them.