Page 1 of 1

[Solved] Clearing browser caches after major site changes

Posted: Thu Aug 04, 2011 5:15 pm
by janaf
I have just upgraded my site and made changes to the menue structure. I am not sure how the cache settings per page have been set.

Assume the pages they have cached already have a long timeout, then how do I refresh their pages?

Is there a way I can induce/force clearing the users browser cached pages?

Re: Clearing browser caches after major site changes, how?

Posted: Thu Aug 04, 2011 9:37 pm
by fredp
Hi,

It's not a perfect solution, but you might experiment with appending a new query string parameter to all the URLs on the site. A temporary .htaccess mod_rewrite rule might be a reasonable way to do this. You might then keep the rule in place until all the older content is set to expire, then remove it.

Off the top of my head (no warranty expressed or implied)...

Code: Select all

#Use at your own risk
RewriteCond %{QUERY_STRING} !^.*browsercacherev=.+$ [NC]
RewriteRule ^(.+?)$ $1?browsercacherev=20110804 [QSA,NC,L,R]
The name and value of the param are arbitrary. Modify as you deem appropriate for your situation.

Hope this helps,
fredp