Editing your hosts file overrides the DNS entries for any domain by resolving that domain to the IP address of your choice, this change only affects the computer you are making the change on which makes it very useful for testing websites, for example when performing a migration.
Editing your hosts file on Window 8, 8.1 and 10
- From your start menu locate notepad, right click and select Run as administrator (You may be asked to enter your administrator password at this point)
- From Notepad select Select file > open
- Navigate to C:\Windows\System32\drivers\etc (this assumes Windows has been installed to the default directory)
- To the right of Filename select All Files (*.*)
- Open the file named hosts
- Create a new line at the bottom and enter the IP address of you new website followed by the domain name, for example:
192.168.0.10 myeukwebsite.co.uk www.myeukwebsite.co.uk
Note: Wildcard entries are not supported within the hosts file, in the example above we have included both the non-www and www version of the domain.
- Select File > save
- The change is immediate, now when you enter your domain into your browser it will resolve to your new website allowing you to test your site before going live.
How to disable your host file entries
If you need to revert back so your domain points at the original IP you can either delete the line you entered and save or you can comment it out by prefixing the line with # which allows you to easily switch between your old and new sites for testing.
As soon as you save the change will take affect.
The hosts file and syntax used is standard across almost all operating systems, on Linux or macOS you can find the hosts file here: