If you have ever tried to move your website from one server to another, you inevitable have come upon a challenging issue. Since DNS takes between 24 to 48 hours to propagate, you are stuck not really knowing if your new server is properly configured.
As a result, your site could go down while you wait over the next couple days, and you won’t even know it unless you constantly watch it all day each day until it is fully propagated. For all practical purposes, this just isn’t feasible.
Fortunately, we have come up with some easy and clever methods for you to test your website on the new server, both before and after moving it, without waiting for the DNS to fully propagate. This way, you can test as good as possible before switching over your nameservers, and you can also catch any major errors easily during propagation, so if needed you can switch the nameservers back to the original working server until you can iron out the difficulties, rather than suffer your visitors to see a site down while you work tirelessly on it with high stress.
First of all, the first thing you should do is set up a subdomain of a differnt, unused domain name, pointed to the same directory.
For example, say your website is called “yourwebsite.com”; and you have another sparedomain called “sparedomain1.com” which you aren’t using. Assume that yourwebsite.com is pointed to the root directory, i.e. on your server in /public_html/.
Now, create a subdomain called “sub.sparedomain1.com” and point that to the root, the same path where yourwebsite.com is pointed. What this will do is allow you to first test your website before moving it, by going to your spare domain’s subdomain which is pointed to a copy of your website files.
Now, make a full copy of your website if you have not already, and put that in that same place on the new server. Make sure you added the sql databases, as well as updated the database config files. For example, if you are using wordpress, make sure that your wp-config file is updated with the correct details for the new server database and user.
If you did all correctly, you should see a live copy of your website when you visit sub.sparedomain1.com. Now, you can begin testing.
The next step after you added an addon domain of yourdomain.com, is to change the nameservers at your registrar to the new server.
Now here is the trick. The problem is that when you visit yourdomain.com, you won’t have any idea if you’re looking at the new server or the old server. So even if it is up, it doesn’t mean the new server is working because you could be looking at the old server.
So the trick is to put a file in the root directory, for example mytestfile.htm, and put the same file in the root on both servers. Inside the file, type something simple to identify the server.
For example, on the old server, you could type “old server” into mytestfile.htm.
Then on the new server, open the file with the same name there and type in, “new server” inside.
Now that you have completed this, and after you changed your nameservers, now go to yourwebsite.com/mytestfile.htm and see what it says. If you see “old server”, you know that your computer is viewing the old server not the new one, so when you go to yourwebsite.com, you know you are not viewing the new server. But if it says “new server” then you know your computer is viewing the new server and the DNS has propagated to you, so now you can test yourwebsite.com.
There is another difficulty however. You may not want to wait, and instead you may want to test it immediately to be sure it is working. From your home PC on the default IP, this simply is not possible. However, there is a trick that we came up with to do this.
Step 1 is to test DNS propagation somewhere like http://whatsmydns.com. Now put in your domain and see if it is propagated anywhere yet. Most likely, it has already propagated to at least a couple cities right away. Now, say for example it shows that it is now propagated to New York only. This is perfect, now you can proceed to go to the next step of this trick.
Step 2 once you know what city, is to use a VPN to change your IP address. A good paid VPN service will allow you to change your IP and city on the fly. For example, the VPN that we use would allow us to choose the city of New York to have a VPN IP from there.
Now, the VPN is not guaranteed to work for this, because even though you chose the city, the exact IP where the VPN is may not have your new server propagated to it. So, this method is hit or miss.
If that happens, you can do another method. We recommend to open a tor browser, and go to yourwebsite.com/mytestfile.htm. Sometimes you may get lucky and it gives you a propagated IP right away. But if you see “old server”, then here is the next trick.
In Tor, just keep choosing “New Tor Circuit For This Site” (or press Ctrl+Shift+L). Let it load and see if it gives you one that works. If you still see “old server”, then just keep getting a new tor circuit until you see “new server”. Once you see “new server”, you’re in luck! Now you can test your propagated website on your new server from inside Tor to see if it works. You may need to do this a lot of times until you get an IP that is propagated.
It is worth noting that tor blocks some scripts, so you may need to allow it. But at least this is a way to see if your website is even up at all on the new server, without having to wait 1 to 2 days with potentially thousands of visitors viewing a broken website if it isn’t working.
So this is the way you can easily, well, kind of easily test your website on your new server before it has fully propagated. The longer you wait the better chance of tor or your VPN working to test it.
Hope this helps you! Let us know if this worked for you or if you have any questions about these tips and tricks for managing your new site migration.