I'm sure at this point, you're a combination of excited, anxious, and a bit nervous. You've just migrated a database, moved quite a few files from one server to another, and updated a WordPress configuration file! We've got one more step to go, and this is to test your website by using a hosts file modification.
Before we continue, let's summarize our scenario:
- We're changing hosting companies, HostXYZ to Web Hosting Hub, and in this move we need to migrate our WordPress Site my-wordpress-site.com
- We want to test our WordPress Site before pointing it from HostXYZ to Web Hosting Hub to ensure there are no problems for us or our site visitors.
That's it. We've done all of the hard work, and now we need to test the site. We can't just visit my-wordpress-site.com, as this will show the site on HostXYZ's servers and not the content we just migrated. We also can't use our Temporary URL as WordPress is domain specific, in our case meaning the site won't look right on the Temporary URL. There are several other ways to test your site, but we find that doing a hosts file modification is by far the most accurate.
How does a hosts file modification work?
When you type in my-wordpress-site.com into your browser, your computer needs to know which web server to contact to download the webpage. It finds this server's address by asking a nameserver. You can think of a nameserver as a phone book. If you need to know someone's phone number, you look in the phone book. Your computer does the same thing, but it uses a nameserver instead.
If my computer asks a nameserver for the address of my-wordpress-site.com, it will return the address for a server at HostXYZ, which will not allow me to properly test. A hosts file modification instead tells your computer to NOT looks at the namserver (ie. phonebook) but to instead use a specific address (your server's IP address here at Web Hosting Hub). In this way, you can visit my-wordpress-site.com and see what it will look like on Web Hosting Hub's servers compared to HostXYZ.
Keep in mind that this change is only affecting your computer. All of your regular website visitors will continue to see your webiste on HostXYZ's servers, so you can test and debug all you need without causing any interruption for your normal visitors.
How do I test using a hosts file modification?
For more help with modifying your hosts file, please see either of the following links:
Windows - How to Modify your Hosts file
Mac - How to Modify your Hosts file
After you have successfully tested WordPress on the Web Hosting Hub server, you can be confident that when you update your domain's nameservers towards the end of the transfer process there should be little to no issues with your website after the move.