views:

463

answers:

3

One of my rails apps (using passenger and apache) is changing server hosts. I've got the app running on both servers (the new one in testing) and the DNS TTL to 5 minutes. I've been told (and experienced something like this myself) by a colleague that sometimes DNS resolvers slightly ignore the TTL and may have the old IP cached for some time after I update DNS to the new server.

So, after I've thrown the switch on DNS, what I'd like to do is hack the old server to issue a forced redirect to the IP address of the new server for all visitors. Obviously I can do a number of redirects (301, 302) in either Apache or the app itself. I'd like to avoid the app method since I don't want to do a checkin and deploy of code just for this one instance so I was thinking a basic http url redirect would work. Buuttt, there are SEO implications should google visit the old site etc. etc.

How best to achieve the re-direct whilst maintaining search engine niceness?

+1  A: 

I guess the question is - where would you redirect to? If you are redirecting to the domain name, the browser (or bot) would just get the same old IP address and end up in a redirect loop.

If you redirect to an IP address.. well, that's not going to look very user friendly in someone's browser.

Personally, I wouldn't do anything. There may be some short period where bots get errors trying to access your site, but it should all work itself out in a couple days without any "SEO damage"

Eric Petroelje
Redirect to IP address of new server
Matt Rogish
@Matt - the problem then is that any pages picked up by spiders during that time are likely to be labeled with the IP address rather than the domain name. So when someone sees the search result in google, it'll show http://192.168.1.1/your_page.htm rather than http://yourdomain.com/your_page.htm. I would think it would be better to just wait for the spiders to pick the pages up correctly a few days later than to risk having "domainless" pages in the search results.
Eric Petroelje
A: 

One solution might be to use Mod_Proxy instead of a rewrite to proxy traffic to the new host. This way you shouldn't see any "SEO damage".

slillibri
A: 

I used rinetd to redirect the IP traffic from the old server to the new one on IP level. No web server or virtual hosts config needed. Runs very smoothly and absolutely transparent to any client.

kpi