1. Home
  2. Support
  3. General
  4. Use your hosts file to test your site without changing DNS

Use your hosts file to test your site without changing DNS

Usually the final thing you’re looking to do after migrating your site over it to test it as thoroughly as possible. In most cases you can fully test the functionality of your newly migrated site with the inbuilt ‘Instant access domain alias‘ however sometimes a website can be vitally dependent on the URL being correct, if it’s not “yourdomain.com” it might not work at all! So how can you test your site will work once the you make that DNS change? Answer, edit your local ‘hosts’ file.


What is a hosts file?

It’s a simple file which tells your computer where to look for specific hostnames or more appropriate in this case, domain names. Mapping IP addresses to hosts/domains.

Where is it?

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

Mac : /etc/hosts

Linux: /etc/hosts

How do I edit it?

Windows: A bit of Google looking will give you all sorts of ways to do this for various Windows versions. The way I do it is to navigate to C:\Windows\System32\drivers\etc\ and copy it into ‘My Documents‘ . Open it in Notepad, edit* and save.

*The syntax is fair straight forward, IP address followed by the domain in question:

123.123.123.123 mydomain.com

Then I copy and paste the edited file back into the original location, confirming the overwrite of the original.

Mac/Linux: Same thing, different file location. Open /etc/hosts using your favorite editor, edit using exactly the same syntax and save.

At this point you may want to flush your DNS open a browser and navigate to your site. That’s it, you’re done.

Was this article helpful to you? 1

Last modified: 15/08/2019