The hosts file determines the IP address on which your computer searches for a site. This is useful, for example, when testing your site on a new server. By adding a line in the hosts file you can make your computer search for the new server while other visitors see the live site. You can simulate that the DNS (Domain Name System) has been converted. So if you go to your domain in your browser, or one of the other domains in your hosts file to our server, your browser will retrieve the content from our server. Your browser will contain the live domain, but in fact you are browsing around on the new server with us. In this manual we will show you how to edit the hosts file on a Windows computer. If you have a Mac computer you can read here how to edit your hosts file.
- Go to the folder "C:\Windows\System32\drivers\etc" and open the file "hosts" with notepad as administrator.
Opening as administrator allows you to save the file after it has been modified. You can now see in the file what the file does on your computer.
- Add a line containing: the new IP address of the site in + the name of the site with and without www.
- Save the file.
The computer will now search for savvii.nl and www.savvii.nl on the entered IP address. The site that is live can still be seen by other visitors. If you want to put the site live on the entered IP address, you will have to change your DNS.
Test adaptations hosts file
You can use the ping command to test if it worked. You can execute this command in the command prompt (cmd). With the ping command the computer tries to connect to the site and you can see on which IP-address this is done.
- Search for 'cmd' in the Windows search bar and open the program.
- Enter the command 'ping' + the domain name.
- Press enter to execute the command
You will now see the IP address from which the computer collects data when you search for savvii.nl. You can also read whether a successful contact has been made. The computer receives an answer from the IP address, which means that the connection is good.
Restore hosts file
If you want to see the live site again, you can remove the line from the file or place a fence (#) in front of the line. When you put a check mark in front of the line, the computer will see it as a comment/notice, so no changes will be made to the settings on your computer.