How to clear a 301 redirect that has already been stored in the browser cache?

7

To get easy to understand the problem, I will call the site that had the redirection of "A" and the destination of "B"

A 301 (rather than 302) redirect was made from site A to site B without any expiration date, since the server was not sending the expires headers, users who accessed at the moment continue to be redirected to site B, even with the .htaccess redirection removed (default behavior of a 301 redirect).

However, site A is well-accessed and in the time it was that way, some users have accessed it. Fortunately both domains are properties we have access to, however we can not create another redirect (even though 302) from site B to site A, to invalidate the previous one in browsers that have already cached.

This technique works, however, site B is also highly accessed.

I wonder if there is any way to clear this redirect in browsers that have cached without user intervention.

One possible solution was to detect if site B was accessed by site A and manage this by some script in PHP for example (creating a redirect back, only when it had been from source site A, creating a loop that invalidates the cache). However I did not find any variables that could determine that the site was redirected and its source was site A.

  

Updated

I have received some answers to invalidate the cache, they work, however I can not leave domain B redirecting to A to invalidate the cache, because both are different and well-accessed sites.

>

Is there a solution to this problem?

    
asked by anonymous 06.10.2017 / 02:14

1 answer

6

The redirect cache is in the client (browser or database browsers), what you have to do is move the new address to redirect back to the old one again.

Assuming you first move http://site/foo.html to http://site/baz.html :

RewriteEngine on
RewriteRule ^foo\.html$ baz.html [R=301,L]

The browser will store this (and search engines like Google as well), so if you want to re-ignore the "cache" ( note: there is no header Cache-Control) move back, flipping baz.html by foo.html, like this:

RewriteEngine on
RewriteRule ^baz\.html$ foo.html [R=301,L]

This is true even on sites in different domains, the new site will need a .htaccess or have your headers routing back.

Then the client will revalidate , of course if it is a browser I can not say that this happens at all, if it happens then unfortunately the way is to clear the data of navigation.

    
06.10.2017 / 23:55