With your hosts file, you can tell your computer which IP address you want to use to access a website. This way you can test a site on a different server than the one the DNS is pointing to, for example when your site has just moved.
Modify hosts file
To change your hosts file, you need the IP address of the server on which you want to test the site. You can find the IP address of the Savvii server on which your website is located after a move via admin.savvii.com, under 'Manage' -> 'DNS'.
The easiest way to open your hosts file on MacOS is via the command line. The best way to do this is to open the terminal. You can do this by pressing CMD + space, and searching on 'Terminal'. Then open the terminal by pressing Enter.
In the terminal type the following:
Pressing Enter will prompt you to enter your user password. Please note that you will need to enter an administrator password.
In the file this opens, add a new line that looks like this:
xxx.xxx.xxx.xxx your-site.com www.your-site.com
Replace xxx.xxx.xxx.xxx.xxx with the IP address you searched for earlier, and your-site.nl with the domain name you want to reach the site on.
Then save the file by pressing CTRL + O, and close it with CTRL + X. Don't forget to restart your browser to let it load the change.
Testing changes
There are a number of ways to check if the change in the hosts file has been successful. This can be done by adding this extension to Chrome. It always shows in a small block which IP address you are connected to.
You can also type the following in the same terminal you just used:
If you now press Enter, you will see from which IP address the answer comes.
Does the ping work, but can't see the change in your browser? Restart your browser.
Reversing the change
You can undo the change in the hosts file by deleting the line from the file. Another possibility is to add a # to the added line. Windows will see the line as a comment and will not do anything with the information. Don't forget to save the file after this!
Was this article helpful?
That’s Great!
Thank you for your feedback
Sorry! We couldn't be helpful
Thank you for your feedback
Feedback sent
We appreciate your effort and will try to fix the article