Hosting

How to edit the hosts file on Windows

If you want to check how a website looks before changing the domain's DNS, you can edit the Windows hosts file. This forces your computer to resolve the domain to the IP of the server where you are building the site (or any IP you want).

Step by step

  1. Open the Command Prompt as administrator.

Opening the Command Prompt as administrator

  1. Run the following command:
start notepad "C:\WINDOWS\system32\drivers\etc\hosts" -h
  1. Notepad will open with the hosts file. Add the IP and the domain you want to force. We recommend adding the domain both with and without www:
5.134.119.90 mywebsite.com
5.134.119.90 www.mywebsite.com

hosts file edited with the IP and domain

  1. Save the file. From that moment on, visiting the domain from your computer will load the content served by the IP you configured. You can verify it by running a ping:

Verifying the configured IP with ping

Once you finish testing, remember to remove the lines you added from the hosts file so the domain resolves through its real DNS again.