How To Test a Website Before Updating Name Server Details

If you are moving a site to a new server, or building a site for a client, and wish to test it before updating the name servers, then this task is very simple to do, especially if you have a Linux PC.

All you need to do is add a line in the etc/hosts file like this:

Where is the IP address of the new server.

From now on whenever you look at in a browser you will see the version on the specified server rather than the version where the name servers at the registrar point to. This is possibly one of the most useful and yet most basic testing tools when rebuilding a website for a client, as it gives you an easy way to view and test the site while you are building it without comprimising the live version. The new site can be built and tested fully before updating the name servers and putting the new site into the “production environment”.

It can also be done on a Windows machine, just reboot the pc after amending the hosts file (there is no need for a server restart on Linux). Locatation the hosts file in Windows (Windows NT/2000/XP/2003/Vista/7);

%SystemRoot%\system32\drivers\etc\ – this is the default location, which may be changed. The actual directory is determined by the Registry key \HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\DataBasePath.

Remember to always test thoroughly before passing a new site to a client.


  • Hi I have a apple computer, how can this be done on apple??

  • Apple? No idea. Don’t Apples have host files too?

    This may help;

    But to be honest, I know nothing about Apples (apart from the fact that an apple a day keeps the doctor away).

  • Oh, some Windows OS do not need a reboot after the hosts file is changed.

    Also, remember to delete the line in your hosts file after testing etc. as this can cause confusion later on for you!

Join the Discussion

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>