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.