How Do I Preview My Site Before Updating DNS?

Keith,
Removing: Date of Publishing the Article

Q: How Do I access my files on the new server ?
I’ve recently purchased hosting from HostGator and have transferred all my files to new servers. I want to preview it and make changes before letting it live to my audience. Is it possible? If yes, how can I do that ?

Yes, it’s absolutely possible to preview and make changes to it before making it live to general public.

Here are the simple steps:
Usually computers look at the IP in the local host file before looking into the actual DNS( Domain Name System ).
So make changes to this simple file on your computer and trick the computer!

If you are using Windows XP or Windows 7 Operating System, then goto this location, to locate the ‘host’ file: c:\windows\system32\drivers\etc\hosts
(Ofcourse if you have installed your OS on a different drive, then the path differs accordingly.)

Open the host file in a simple text editor.

The content looks something like this:

# Copyright (c) 1993-2009 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a ‘#’ symbol.
#
# For example:
#
# 102.54.94.97 rhino.acme.com # source server
# 38.25.63.10 x.acme.com # x client host
# localhost name resolution is handled within DNS itself.
# 127.0.0.1 localhost
# ::1 localhost

Now get the new Dedicated IP Address of your server/host from your new hosting provider.
Usually it will be present inside the cpanel.

Assume that new dedicated IP is 165.100.98.10 for www.yourdomain.com

Now: add this line of code to your host file.

165.100.98.10 yourdomain.com www.yourdomain.com

Now your host file looks something like this:

# Copyright (c) 1993-2009 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a ‘#’ symbol.
#
# For example:
#
# 102.54.94.97 rhino.acme.com # source server
# 38.25.63.10 x.acme.com # x client host
# localhost name resolution is handled within DNS itself.
# 127.0.0.1 localhost
# ::1 localhost
165.100.98.10 yourdomain.com www.yourdomain.com

now restart the browser. If it doesn’t work, then it’s due to the cache.

To clear the cache use these dos commands:
Goto your command prompt.
type “ipconfig /flushdns” (without quote).

Now restart your browser and visit your site.

Finally:
Once you make changes and change your original DSN to point it to your new server, then make sure to delete the line of code you added to your local ‘host‘ file.