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 00.00.000.000 is the IP address of the new server.
From now on whenever you look at www.test_the_domain.com 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.