Mobile app version of vmapp.org
Login or Join
Debbie626

: How can I 301 redirect back to a url that was previously 301 directed away from? The domain example.com had a 301 redirect set to go example.co.uk Now the decision has been made to use example.com

@Debbie626

Posted in: #301Redirect #Htaccess #Redirects

The domain example.com had a 301 redirect set to go example.co.uk

Now the decision has been made to use example.com as the main domain, so a 301 redirect is required from example.co.uk.

But because the previous redirect is cached everywhere, repeat visitors will end up in an infinite loop, as I did. I can empty my cache to make it work, but I can't empty theirs.

I have to go with 301's to preserve seo page rank.

The only solution I can think of is to add a new redirect from example.com to example.co.uk with an expiry date on. Hopefully this would overwrite the previous one that presumably has no expiry date. Then, after a suitable period of time when I think the site has been reindexed and the majority of visitors have returned, and the 301 has expired I could remove it and set up my new one from example.co.uk to example.com.

Does this sound like a possible strategy? If not, how does anyone ever get out of this hellish situation?

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Debbie626

1 Comments

Sorted by latest first Latest Oldest Best

 

@Alves908

You should add Cache-control headers to the 301 responses. Consider setting a short (1 day) expiry. Start tracking your 301 responses by site and URL to determine when the 301 response rates have stabilized. At that point you should be able to consider switching URLs. Remove the cache time, and wait that period. (301 rates should increase.)

This can be done as follows

RewriteCond %{HTTP_HOST} ^www.example.co.uk [NC]
RewriteRule ^(.*)$ www.example.com/ [R=301,NC,L,E=nocache:1]

## Set the response header if the "nocache" environment variable is set in the RewriteRule.
Header always set Cache-Control "no-store, no-cache, must-revalidate" env=nocache

## Set Expiry
Header always set Expires "Thu, 01 Jan 1970 00:00:00 GMT" env=nocache


Your company has painted itself into a corner by stating they will never use example.com as the domain with the 301 responses. If they haven't painted themselves into the corner with example.com, I would use that as a stepping stone. Browser caches can be extremely long lived, especially if clients have example.com bookmarked.

Redirecting to a different (never used) path should also work. This may impact your SEO rankings.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme