This article is also available in:

How to find and edit host files on Windows?

The Hosts file is an essential tool to change the way your computer sees a particular website.

While most users will never need to edit their hosts file, a web developer or user may need to edit the file to view a new site under development.

In order for your computer to display your test site rather than the live site, you must add the test site IP address and domain name to the Hosts file.

As long as this information is contained in your Hosts file, your browser will redirect the request to display the site to the specified IP address.

This allows us to test the functionality without changing the DNS of our production site.

### To edit the file, follow the steps below.

Look for the tool Notepad or Notepad ++ in the Start menu.



Right-click the tool to access the options menu. Select Run as administrator.



Once in Notepad, click “Open” in “File”.



Open the «host» file in Windows Explorer via the path: C: Windows System32 drivers etc hosts.



You can now edit the host file.

On a new line, enter the IP address of the test server and the domain name you want to use for that IP address (for example: '123.123.123.123 VOTREDOMAINE.FR`. Of course: 123.123.123.123 will have to be replaced by the IP address of the server and votredomaine.fr will have to be replaced by your own domain name).

In addition, if your site was using the www. , you will also need to put the following line: `123.123.123.123 WWW.VOTREDOMAINE. This saves the changes made to the file.


Updated on: 24/10/2023

Was this article helpful?

Share your feedback

Cancel

Thank you!