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 Mac computer. If you have a Windows computer you can read here how to edit your hosts file.

- Use Spotlight to search for 'terminal' and open the program.

- Type the following command in the terminal: sudo nano /private/etc/hosts and press enter.

- Enter the password for your admin account and press enter (no characters are visible when you type the password).
Note: This is your computer's password. You can't use the password of the website here.

You will now see the hosts file. In this file you can access sites on a different IP address when you add a line.

- Add a line with the new IP address of the site in plus the name of the site with and without www.

- Save the file with CTRL + o (the terminal will ask if you want to overwrite the file, press enter to confirm).

Finally, you can empty the cache memory. Then you can be sure that the changes are coming through and you won't see an old situation. You can do this in the terminal after you have closed the hosts file

- Close the hosts file file with CTRL + x .
- Type the following command in the terminal: dscacheutil -flushcache.
The computer will now search for and 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 the DNS.

Test adaptations hosts file

In the terminal you can also test whether the computer searches for this IP address. You can do this by using the ping command.

- In the terminal, enter the following: ping + your domain name. Press enter.

In the window you can see with which IP address the computer communicates and whether the data is received successfully. In this case it didn't work out. No data packets were received on the site. If this is the case, then a successful connection has been made.