Don't actually do this until you read through this entire post and understand what's going on.
OH: old host server
NH: new host server (here)
This assumes that your OH is running cPanel. On the OH, go to WHM and go to the DNS for your domain (Edit DNS Zone). The second column in the list is the time to live or TTL value. This value is the number of seconds that DNS clients will cache (or remember) the value of the DNS entries. Most likely, the NS and the major A entry (the one for the domain itself) will be set to 86400 seconds, which is 24 hours. Other entries are likely to be 14400 seconds, or 4 hours.
You need to find the maximum TTL value for your domain DNS entry. This will tell you how far in advance you must reduce the TTL before you can start doing the transfer. So in this example, the largest entry present is 86400 or 24 hours, which means that you must wait 24 hours after lowering the value before you can start the transfer. This has the effect of making sure that all visitors will be switched over at the same time, whether or not they have cached DNS values for your site already, since the TTL value determines the next time that DNS clients must check in with the server to get an updated address.
So, with that in mind, 24 hours (assuming that is the right value) before you plan on doing your transfer, go through the entire list of TTL values and reduce them to something small such as 15 minutes (900 seconds). So assuming you choose 15 minutes, go to each of the TTL boxes and replace the existing values (86400, 14400, etc) with 900. This instructs DNS clients to check back with the server for new DNS data if the cached values the client has are older than 15 minutes. This will result in increased traffic for your DNS server (bind I assume) but this will only be temporary.
Now wait 24 hours (or however long the maximum TTL value was).
On your NH, make sure that everything is set up that you will need, especially your web server, database, PHP, etc. Make sure that the NH hostname has an A entry in its DNS and that the new nameserver IPs are set up in the NH DNS as well.
When the waiting time is up, you can start doing the transfer. If you have a dynamic website that uses a database, close the website down so no changes happen to the database while you are transferring. The transfer program in WHM should work very well for moving your stuff. One thing you will need to keep in mind is that if you have a firewall installed on the NH then you will need to open up the SSH port that the OH uses before you can try using the WHM transfer tool, otherwise it will not be able to connect. If this process fails for any other reason, open up a support ticket and the guys will do this by hand for you.
Once the transfer is completed, you can go to http://hostname/~user
and make sure that the website is working properly. If you had to disable it before, enable it again now.
In the NH WHM, go to the DNS page and make sure that all the entries are set up properly to their new permanent values. DO NOT use the shortened time (15 minutes) here, this is where you must go back to using the normal values (24 hours, 4 hours, etc). All of the A values should direct to your NH IP addresses.
Now this is the point where we will go back and flip over the DNS. Go to the OH WHM and load up the DNS page like before for the domain. Change the A entry for the domain to the NH IP value. Change the A entries for the name servers to the NH values. Change the A entries for all subdomains to the NH values. Now submit.
At this point, this is how the situation looks like:
- Visitor asks for NS record from your domain name provider, which directs the visitor to the OH.
- OH DNS A entries are set on a 15 minute TTL and direct the visitor to the NH.
- NH DNS entries are set on the 24 hour TTL and provide the final step, and resolves to the website which you have moved over to NH.
In essence, the OH is acting as a connection relay while your domain name is still pointing to it. Once the NH is completely operational and all sites are working properly, you can then go to your domain name provider and have the name server IP addresses updated to point directly to the NH.
While these changes are propagating (about 48 hours or so), you keep the OH online (although you can remove all the files that are still there and shut down the web server) so that the OH DNS server will continue to relay connections over to the NH. I would wait about 3 or 4 days (there is no rush here) before shutting down the OH server.
Using this approach, your downtime should be limited only to the amount of time you need to transfer the files if it is a dynamic site or if it is a static site, the transfer should appear seamless.