Window Host file – Check website without changing DNS 

Why is a Hosts File Useful?

Let’s say we have just completed a migration to a new server. In order to see how our domains will look and operate on our new server before we move our DNS settings, we cannot just type in one of our current domain names as it will resolve to the old server we are moving away from (since we never move our DNS A records from the old server until we are sure the new site is working as expected).

So, to see how our domain will look on the new server, (without having to change our DNS records) we can simply modify our local hosts file to point the domain to the new servers IP. If our domain is liquidweb.com and the old IP is 67.225.187.61 and our new IP will be 72.30.35.10, we can temporarily comment out the current liquidweb.com entry (using a ‘#’ symbol) and add an alternate entry which points to the new servers IP.

To check a website using the host file on Windows, you can follow these steps:

  1. Open File Explorer and go to the following directory: C:\Windows\System32\drivers\etc\.
  2. Locate the file named “hosts” and open it with a text editor (e.g., Notepad) as an administrator. You may need to provide administrative permissions to edit the file.
  3. In the “hosts” file, you can add an entry to map a domain name to an IP address. Each entry should be on a new line and follow the format: <IP Address> <Domain Name>. For example:
   127.0.0.1    example.com

Replace 127.0.0.1 with the actual IP address you want to map the domain to, and example.com with the domain name you want to check.

  1. Save the changes to the “hosts” file.
  2. Open a web browser (e.g., Google Chrome, Mozilla Firefox) and type the domain name you added to the “hosts” file in the address bar.
  3. The browser will now use the IP address specified in the “hosts” file to access the website instead of querying the DNS server.

Note: It’s important to remove or comment out the entry in the “hosts” file once you’re done testing to ensure that your browser uses the correct DNS resolution for the domain. Failure to do so may cause issues when trying to access the actual website in the future.

Remember that using the “hosts” file only affects the local machine where the file is modified. Other devices on the network will not be affected by these changes.

https://www.liquidweb.com/kb/edit-host-file-windows-10/

Leave a Reply

Your email address will not be published. Required fields are marked *