0

So I've developed a website for a client, however he used to use this url with a re-direct to 'another' site of his. I had the re-direct cancelled, but whoever visited their old website before, still has it in their cache that it redirects to the old site.

This can be solved by a browser cache clean-up, but I was wondering if there was another way of solving this. Especially because I do not think my users will understand what "clearing the cache" means (target demographic is age 60+).

0

To turn off caching, you can send the following response header for the URL in question:

Cache-Control: no-cache, no-store, must-revalidate

These three directives pretty much instruct clients and intermediary proxies not to use a previously cached response, not to store the response, and that even if the response is somehow cached, the cache must be revalidated on the origin server. Cache-Control: no-store in responses bypasses all tested browser caches correctly, and Cache-Control: no-cache in responses will correctly get stored, but checked on each request.

or setup a script to do a POST to the URL in question to invalidate the cache:

HTTP specifies that caches should be invalidated when unsafe request methods are used and the response is successful – i.e., a 2xx or 3xx status code. Unsafe methods include POST, PUT and DELETE, as well as unknown status codes.

References

  • 1
    This only works on first visit, not after the fact. – Rob Aug 5 '18 at 13:12
0

If possible, the easiest way would be to put up a notice on the target site of the redirect, encouraging users to visit the original site. You could even throw in some relevant content and make it a marketing thing.

That way, you can have users click a direct link. It should bypass the redirect, and maybe convince their browser to purge the cached redirect.

0

Since the user will no longer visit the "old" website, or your "new" one the only solution is to change the website they do visit, the "other" website to redirect users back to your "new" website.

There seems to be some confusion over whether another 301 or 302 redirect will cause the original cached redirect to invalidate. see:

https://stackoverflow.com/questions/9130422/how-long-do-browsers-cache-http-301s

Some people are reporting that they have tested a 301 and it works, others that it will cause a redirect loop error.

Another method might be to you run a some javascript (on the "other" website) that does a Post to your url, it may clear the cache for that url.

Generally though, it seems to be agreed that the permanent caching of 301s in some browsers is a massive problem.

If you can't get access to the "other" site, or you find that the redirect loop error is not fixable for your users, then you may just be best off duplicating the site on a new url.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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