Point domain via hosts file

  •   08/21/2026 3:45 PM
  •  

When your computer does a DNS lookup, it will check the "hosts" file for an entry on the domain.  As a result, you can point a domain to any IP that you want.  For example, when testing a new version of a site on a different platform or server.  The hosts file is a plain text file that is edited using a plain text editor such as notepad, textedit, gedit, etc. 

Edit the hosts file:

Windows:  C:\Windows\System32\drivers\etc\hosts

Linux / Mac: /etc/hosts

Once opened, add an entry similar to:

1.2.3.4 example.com www.example.com

Where 1.2.3.4 is the real IP and example.com is the real domain.  It is important to have the www record also unless you exclusively use the non-www version. 

Save the file, restart the browser, and the domain should now point to the entered IP and you should see that version of the site.


  Print