How to view your site before changing nameservers

→ Are you a new visitor? Please visit the page guidance for new visitors ←

How to view your site before changing nameservers

This is a topic which I found quite useful in cases where you need to move your site to a new provider while keeping your downtime to the minimum or no downtime at all. The trick here is to have your site run on two servers, your old hosting provider and new hosting provider. So the question to this topic is “How to view your site before changing the nameservers”?

It’s fairly easy, involves changing a simple “hosts” file from your operating system with the correct/new IP of your hosting provider.

Assuming that you have already copied your content to your new hosting provider, now you need to check if everything is order and that your site is working as expected.

For this, you need to locate your new hosting account server IP, if you can not find this, please ask your new hosting provider for your new IP address. It doesn’t matter if it’s a dedicated or shared IP, you just need to know the correct one to point your domain to it.

Now that we have your new hosting IP address, we proceed to setting your domain to point to this new IP address. As I mentioned already, we need to change a file named “hosts”.

On most Windows systems you can find the hosts file in

  • %SystemRoot%\system32\drivers\etc\hosts   NT, 2000, XP (x86 & x64), 2003, Vista, 7 and 8
  • %WinDir%\HOSTS  — 95, 98/98SE, Me
  • %WinDir%\hosts — 3.1
  • Registry key under HKEY_LOCAL_MACHINE\Comm\Tcpip\Hosts  — Windows Mobile

For Apple Macintosh this can be found at the following location:

  • Mac OS X 10.0 – 10.1.5 — Added through NetInfo or niload
  • Mac OS X 10.2 and newer — /etc/hosts (a symbolic link to /private/etc/hosts)

For Novell NetWare this is located in SYS:etc\hosts.

On most Linux-based systems, the hosts file can be located in /etc/hosts.
Now the correct form to enter your IP and domain name is:IPADDRESS  DOMAIN NAME

For example:

192.168.1.1 yourhowto.net

Then proceed to saving your host file and clear your DNS cache from your system.

And that’s about all, your new domain name is now pointing to your new hosting service.

After finish testing, remove the line added to your hosts file and change your nameservers to your new hosting account.

Request an article ←