Cache busting: suggestions?

I am creating a new site for a colleague. At the very beginning a number of folks will be visiting her site multiple times as small iterations of improvements are published. What techniques do each of you use so every time a web page is visited the user will auto-download the latest version?

All of her pages will be lightweight … so the advantages of images and other content being cached are very minimal. The deficit, however, of fairly tech-ignorant users is high! I’m trying to avoid repeatedly telling a small group of folks to refresh their browser or empty their cache.

I often put a banner at the top of a dev site telling the user to clear their cache to see the latest version, with links to web pages explaining how it’s done on the various browsers.

Doesn’t really seem to make much difference, they still email me saying they can’t see the updates. But at least I can point them to this banner, opposed to explaining it for the 'nnnth time.

You could add

<meta http-equiv="pragma" content="no-cache" />

In the testversions of your site. Just make sure to delete it when the site goes public.

1 Like

Thanks to both @TemplateRepo and @Fuellemann ! I also found some code to put into the htaccess file. It is:

<IfModule mod_headers.c>
  Header set Cache-Control "no-cache, no-store, must-revalidate"
  Header set Pragma "no-cache"
  Header set Expires 0
</IfModule>

I’m not a coding person. I can see there are similarities between what @Fuellemann provided and the code above. But I have zero idea about the practical differences between the two. Anyone able to explain?

If the meta-code provided by @Fuellemann is better then it’s easy for me to implement, and certainly easy to delete after this testing phase is over.

1 Like

Just try mine first as you would not need to change the htaccess file.

@Fuellemann Easy peasy. Seems to be working fine. I put the code in an HTML stack at top of the page. Correct? (Pages are so lightweight I can’t really tell difference between no-caching and cached version speeds.)

Update: I put the code in the header area.

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.