How to Test a WordPress Website Migration using the Hosts file
When transferring your WordPress website to a new webhost, you want to do a thorough testing before changing the nameservers and making your website live on the new webhost. The best method to do this is to modify your hosts file. The following instructions are relevant to users running Windows 7, however they should be similar for other versions of windows.
The first step is to locate your hosts file. For windows 7, it is located in the folder in the following filepath c:\windows\system32\drivers\etc\. This can be accessed easily simply by copying and pasting that link into an open window.
The problem with that folder is that it has administration access restrictions, so you will need to follow the following method to get the changes done. First, drag that hosts file to your desktop, then open it in notepad, and add your changes to the bottom.
You need to add a line similar to this 11.222.333.444 www.rothenterprise.com where the new webhosts ip address is followed by your website address. Make sure there is a space between them, and include the www if that is how your site is setup.
Once entered, you should press Save As, then change the Save As Type to All Files. This should now show the Hosts file, so click on it, then save and overwrite the previous file. This method ensures it saves in the correct format, instead of saving as a notepad file.
The newly edited hosts file can now be dragged back into the original folder, and the effect is that when you try to load your website in your browser, it will load the version on your new webhost, instead of the live version on your old webhost.
If your testing goes well and everything is working fine, you can change the nameservers and your site will be live. Remember to edit your hosts file back to the original settings once the nameserver changes have gone through.