Visitors still see the old CSS or logo: versioned file names and cache busting

You changed the CSS, the logo or a script, and you see the new one but visitors keep seeing the old version. The cause is their browser’s cache: the file was stored with the instruction “keep this for a while”, and until that time runs out the browser does not even ask the server whether it changed. The cure is not to ask visitors to press Ctrl+F5. It is to give the new file a new address.

First: confirm this is it

1 Open the site in a private window. If the new one shows there and the old one in your normal window, it is browser cache.
2 In the normal window, reload with Ctrl+Shift+R (it ignores the cache). If the new one appears, it is cache again.
3 To see how long the file is kept: F12, Network tab, click the file and read cache-control or expires in the response headers.
4 If there is a service in front of the site (such as Cloudflare) or a cache plugin, clear those too, in this order: the site, the service, the browser. See clearing the cache: the browser’s, the computer’s, and the site’s.

The cure: change the address when the file changes

Way Example Note
Change the file name logo-2026.png instead of logo.png The safest. Works for images and fonts. Remember to update the page that calls it.
Add a version number style.css?v=7 WordPress does this by itself with the ?ver= of well-written themes and plugins. Some caching services ignore what follows the question mark.
Fingerprinted name style.3f9a1c.css Produced by build tools. The name changes whenever the content does.

If your cache durations are very long and names carry a version or a fingerprint, you can tell the browser the file never changes with Cache-Control: public, max-age=..., immutable. Only do it when the name really changes with the content. To choose durations, see browser caching with .htaccess.

On WordPress

1 If it was the theme’s CSS that changed: the theme should bump its version number when it updates. If you edited the file by hand, change the number, or add a version where the file is loaded.
2 If the cache plugin combines and minifies files, it generates a new name when the content changes. Use “Purge All” after a change. See minifying CSS and JavaScript without breaking the site.
3 If you swapped the logo or an image, upload it under another name instead of replacing the old one. Replacing the file in the media library under the same name is what leaves the old one stuck in browsers.
The page itself (HTML) should not have a long browser cache. It is what points to the files with new names. If the page is stored for a long time, visitors will never learn that the name changed. The site cache and the browser cache are different things.
Anyone who already has the old file stored is only freed when the time runs out. For a serious defect already live, the only shortcut is to put the new file under another name and change the page. Plan for this before setting very long durations.

Changed the file and some visitors still see the old one? Send us the file’s address and what the cache-control header says.

Open a support ticket

SEE ALSO

Browser caching with .htaccess

Clearing the cache: the browser’s, the computer’s, and the site’s

Cloudflare: when it helps, and the cache that fools you

Hosting plans and what each includes

RECOMMENDED PRODUCT

Web hosting with cPanel

Domain and SSL included, daily backups and the panel you already know. from $6.60/mo (3-year plan, with coupon)

See plans
  • 0 Users Found This Useful
Was this answer helpful?