How to Preview your Website by editing your Hosts file
A company migrates your site, and asks you to take a look at their work before making the site live.
Your site is still live on the original server, so how do you view it on the new one?
Companies like GoDaddy migrates sites in this manner. Now comes the part where you need to check the migrated site, before changing where your domain points. Luckily, there is an easy way to do just that.
Editing your hosts file causes your local machine to skip the DNS process entirely, and look directly at the Internet Protocol (IP) address that you specify.
Modifying the hosts file involves adding two entries to it. Each entry contains the IP address to which you want the site to go to and a the internet address.
For example, add the following two entries to your hosts file, directly after the IP address: www.domain.com and domain.com. Change out ‘domain’ with the real name of your site.
For instance, you might see the below entry, in our hosts file.
So how do I edit my hosts file?
This article provides instructions for locating and editing the hosts file on the following operating systems
- Microsoft® Windows® 10, Windows 8, Windows 7, and Windows Vista™
- Microsoft Windows NT™, Windows 2000, and Windows XP
Edit your hosts file in Windows
Windows 10 and Windows 8
Watch for steps marked with *IMPORTANT – which are flagged as the most common mistakes made. Techsnob.net found several areas that were either incorrectly documented, or extremely vague. These steps, if incorrectly done, will cause the entire process to fail. Due to the confusion, along with the current shoddy documentation of this on the internet, we have included screenshots for all of you.