After making an update to my site's pages, I don't want the cached version of the old page to show up to returning visitors. Is there a way to do this from my side, without the user having to do a hard refresh or deleting their cookies?

  • Are you referring to the actual page, or the linked resources... CSS, JavaScript? "deleting their cookies" - presumably you mean "cache"?
    – MrWhite
    Apr 14, 2015 at 13:52
  • I'm referring to the actual page (the raw HTML). And I mean their cache.
    – Vikram
    Apr 14, 2015 at 13:55

1 Answer 1


The only way you can pull it off if you intend to cache everything and if you are ok with not caching one thing is to do this:

Construct all your pages so that the URL contains a version code in it, then when the page is updated, have the invalid version code redirect to the valid one. Then for the main url, make it redirect to the updated homepage.

Here's an example:

Say your website is: http://www.example.com

and your home page is: http://www.example.com/home.html and your products page is: http://www.example.com/products.html

What you want to do is this:

Make the home page as: http://www.example.com/ver1/home.html Make the product page as: http://www.example.com/ver1/products.html

Then on http://www.example.com, make it a simple page that automatically redirects to http://www.example.com/ver1/home.html

Then when you make an update, simple change ver1 to ver2 so that your home page is http://www.example.com/ver2/home.html and the product page is http://www.example.com/ver2/products.html and www.example.com redirects to http://www.example.com/ver2/home.html.

But in my suggestion, www.example.com root cannot be cached. This isn't the most elegant solution but it can work.

What I do on my site is NOT cache the HTML client side since it averages to 15KB but I only cache the assets (especially images). I do however cache the HTML server side to reduce the time to first byte (TTFB).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.