Domain Names and HOSTS File

This is post is now quite old and the the information it contains may be out of date or innacurate.

If you find any errors or have any suggestions to update the information please let us know or create a pull request on GitHub

If you have recently bought a domain name and updated the nameservers to point to your new hosting, or if you are moving hosts and have update the nameservers for your existing domain name then for a period of up to 48 hours people who type in your domain name into their web browser might get directed to the old server or the new server.

This period is called propogation and these days can be over quite quickly, but is still an important point to be aware of.

However what do you do if you need to make sure you are looking at your new server and not your old server?

You have two options really, you can wait for the propagation to complete or you can edit your HOSTS file to force your computer to look at your new server when you type your domain name.

This is really quite easy. You only need to know one thing which is the IP address of your new server.

Then you find your hosts file on your computer, open it up in a text editor like notepad (for windows) and add a line like this:


123.123.123.123 www.mydomain.com

at the bottom of the file. Then save that file, close all of your web browser windows and reopen a browser session and if you type your domain name you should get forced through to the new server.

See this wikipedia page for info on where to find your HOSTS file.

For windows users, you can generally find your HOSTS file here: c:windowssystem32driversetc


Tags: hosts file