One of the most common questions we receive is “how do I preview my site before updating DNS?”. This is actually quite easy and just involves three simple steps:

Update you local hosts file

Most computers are configured to first look at a local “hosts” file before going to DNS. By simply adding one line to you local hosts file you can easily preview your site. On windows PC’s the hosts file will normally be located at c:\windows\system32\drivers\etc\hosts (the exact location can be different if you did not install windows in the standard “windows” directory). A default hosts file will look like:

# Copyright (c) 1993-1999 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


127.0.0.1       localhost

Simply add a line below the 127.0.0.1 line with your servers IP address and host name with your favorite text editor. The hosts file is simply a text file so make sure the file is saved as plain ASCII text. A sample would be:

127.0.0.1       localhost
123.123.123.123     www.mydomain.com mydomain.com

You will have to use your actual IP address and domain name.

Flush your current DNS cache

If you have been browsing your current site or grabbing email your PC will have the IP address for your web site cached. It’s very easy to flush your PC’s DNS cache:

  • Open a dos prompt (select start, run, type cmd and press enter)
  • Type “ipconfig /flushdns” (without the quotes)
  • Close the Dos prompt by typing “exit” (without the quotes)
Restart your browser

Simply close any / all open browsers and then restart them. You should now be browsing your new web site.

Final thoughts

Remember that you are overriding DNS by putting an entry into the local hosts file. Once you are done testing remember to remove the entry from the hosts file, flush your DNS cache and restart your browser again or you won’t be able to access your real web site.

Leave a Reply