I have the familiar task of moving a website from one dedicated server to another, the ip addresses are locked to the servers so no moving it that way. I have already done the trick of shortening the TTL (time to live) of the DNS zone file entry, but I find this has little effect, it still takes many hours for every request to the domain to always lead to the new server, several hours (upto 72hrs) for the changed DNS zone file to propergate through the internet.
So the question is how does one ensure that all web traffic gets to the new server?
The answer is pretty simple, we use the hostname prefix part of the domain name. Add an entry to the DNS zone file with a new hostname with a prefix that you have never used before, i.e. if your site is domain-name.com you most likley use www.domain-name.com and the prefixless version domain-name.com, so in this case we will add w3.domain-name.com, this needs at least an hour to propergate on your DNS server so do this a little in advance of switchover time. Then when you are ready to switch over simply change the DNS zone file record for the usual hostnames you use, then add a redirect instruction in you Apache .conf files on your old server, or you could add it to a .htaccess file in the root folder of the site:
Redirect / http://w3.domain-name.com/
This line will forward all http requests sent to the old server to be forwarded seemlessly to the new server, even if its a long url with specific detail, i.e. www.domain-name.com/help.html this would be forwarded to w3.domain-name.com/help.html.
This only need be in place for a few days after switchover.
As yet i have not tested weather all requests work, form posts etc, but I see no reason why they would not work.
Good Luck.
Matt
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment