So, your site is already set up on a server, and you’re looking to test it before it goes live. How do we accomplish this? (If you’d like to skip the basics, feel free to jump to the “Changing the hosts file” section below)
When you enter a web address in your browser, it figures out what IP address to talk to using the Domain Name System (DNS). However, before the DNS was created in the early days of the internet, there was a much more basic method to figure out the “hosts” file.
The hosts file is designed to store one line for every website (or host) it talks about, with an IP address and the hostname or website. The only problem is popularity — since billions of websites are out there nowadays, it would be impossible for every computer to keep a list of every website and its IP address. This is why the hosts file is not used much nowadays — instead, you can set up DNS records publicly for anyone to access when needed.
That said, the ability to direct your computer to a specific IP address is incredibly useful for developing and testing websites, which is why it’s still in place on modern computers. When you change your hosts file, your computer will connect to the IP address you’ve set even if the actual website is pointed somewhere else, so you don’t have to change your DNS records before your site is 100% ready.
Step 1. Press the Start button, and then type “Notepad” to search.
Step 2. Right-click on the icon and select “Run as administrator.” You may be prompted to provide administrator rights to Notepad before you can proceed. This makes sure only authorized users can make system changes.
Step 3. Once you have Notepad up, go to File → Open.
Step 4. On the Open dialog box, navigate to C:\Windows\System32\drivers\etc. Make sure that “All Files” is selected on the drop-down menu in the bottom-right corner.
Step 5. Next, open the file named “hosts.” This file already contains useful instructions on using it. We need to enter the IP address of our server and the domain name of the site we are looking to test. In this case, we’re reviewing the example.com domain with IP 192.168.92.68. This entry can replace this with any domain name or server IP.
Step 6. After saving the file, you can go to example.com in your browser, and it will point the request to the server at 192.168.92.68, even if it is not yet live in the DNS. If you’ve visited the site before setting up your hosts file, you may need to flush your DNS cache to get the change to replace the previous cached IP.
Step 7. When you are finished testing, you can follow the same process to remove this entry from your hosts file and start loading the site from its actual public IP address.
If you do not have administrator rights on your computer, you cannot modify the hosts file. Besides using a different computer, there are several other options you can try.
Finally, if you still need help testing a website you’ve hosted with us, feel free to reach out, and we’ll be happy to help.
Our award-winning customer care team is here for you.Contact Support