Mobile app version of vmapp.org
Login or Join
Candy875

: How do I prevent cached pages from showing up to returning visitors after doing a website update? After making an update to my site's pages, I don't want the cached version of the old page

@Candy875

Posted in: #Cache

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?

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Candy875

1 Comments

Sorted by latest first Latest Oldest Best

 

@Annie201

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: www.example.com
and your home page is: www.example.com/home.html and your products page is: www.example.com/products.html
What you want to do is this:

Make the home page as: www.example.com/ver1/home.html Make the product page as: www.example.com/ver1/products.html
Then on www.example.com, make it a simple page that automatically redirects to www.example.com/ver1/home.html
Then when you make an update, simple change ver1 to ver2 so that your home page is www.example.com/ver2/home.html and the product page is www.example.com/ver2/products.html and example.com redirects to www.example.com/ver2/home.html.
But in my suggestion, 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).

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme