Customize your hosts file (Windows)

Modified on Thu, 3 Feb, 2022 at 6:54 PM

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 if 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 where your website is located after a move via admin.savvii.com, via Manage -> DNS.  


Now open your hosts file. By default you will find it in the folder C:/Windows/System32/drivers/etc. Open the file hosts as administrator (click right -> Open as administrator). By default, it will open in Notepad, unless you have set another program as default.


In this file, you 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.  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.  

ping windows hosts file


You can search for cmd by pressing the Start key.  This will open the Windows command line.  In the command line type ping your-site.com, and press Enter.   

 

You can then 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

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article