John
John

Reputation: 473

Cached HTACCESS files

Earlier today I asked a question on SO regarding a redirect in the htaccess file. The answer given to me was actually correct, but because I had failed to clear my cache, my browser was still using a cached version of the htaccess file without my update. After clearing my cache, the redirect worked as expected. I've just installed an SSL certificate for a different client and added some rules to redirect from HTTP to HTTPS. However, I'm thinking about the issue I had this morning. The customer, as well as their return visitors, would have cached the old htaccess file and therefore won't use the updated version. If this was a stylesheet or an image, I'd just add a version number, change the file name, or change the path, to "force" the update. I obviously can't do that here. Is there anything that can be done to force return users to use the updated htaccess file?

Upvotes: 1

Views: 2123

Answers (1)

Joe
Joe

Reputation: 4897

There is nothing you can do about other peoples cache I'm afraid. Eventually the cache will refresh and display the new changes. All it takes is a refresh of the page.

You can tell your website not to cache by using:

ExpiresActive On
ExpiresDefault A1
Header append Cache-Control must-revalidate

But I don't really see much point in doing that unless you're making constant changes to said page. If a client asks you to make a change that requires their cache to be reset, then just tell them to do so, so that they can see it.

Upvotes: 1

Related Questions