There are upcoming maintenance events which may impact our services. Learn more

How to Test Website before Changing DNS/Nameservers Print

  • 122

Below is the method for accessing your site prior to moving DNS. You will be editing the local "hosts" file on your computer to force your domain to resolve to your new server. 


Edit local "hosts" file

 

Dificulty
Easy
This is the preferred methodto test your site if you are using Apache mod_rewrite rules. This method is a bit more in-depth and requires some working knowledge of your operating system. I will attempt to break it down as much as possible.

 

Windows Operating Systems

  1. Locate the HOSTS file on your computers. Typically it is in one of the following locations:
    • Windows NT/2000/XP/2003/Vista/7 - C:\windows\system32\drivers\etc\hosts
    • Windows 95/98/Me - C:\windows\hosts
  2. Open this file with a text editor such as Notepad or Wordpad. (Right-click on Notepad and select the option to Run as Administrator - otherwise you may not be able to open this file.)
  3. Then, open the file. Consider performing a "Save As" so you have an original copy of the file that you can restore later. You will see two columns of information, the first containing IP addresses and the second containing host names. By default, a windows hosts file should be similar to the following:
    • 127.0.0.1 localhost
  4. You can add additional lines to this file that will point requests for a particular domain to your new server's IP address. Example:
    • 127.0.0.1 localhost
      67.222.1.2 example.com
      67.222.1.2 www.example.com
  5. Save your changes.
  6. Restart any currently open browsers. You may also want to flush your DNS cache. In Windows XP, go to Start, and then Run, then type "cmd" and hit enter. Type the following:
    • ipconfig /flushdns
  7. Visit the migrated version of your website by visiting www.example.com or http://example.com in your browser window.

Mac Operating Systems

  1. Open the "Terminal" application.
  2. Use the nano application, with sudo, to modify the /etc/hosts file. (You will be prompted for your password for sudo access.)
    • sudo nano /etc/hosts
  3. Just as with the Windows steps, you can add additional lines to this file that will point requests for a particular domain to your new server's IP address. Example:
    • 127.0.0.1 localhost
      67.222.1.2 example.com
      67.222.1.2 www.example.com
  4. Once you make your changes, type [CTRL] + X to save the file.
  5. One last step to clear your cache and make the new settings take place. Run the following command while still in terminal:
    • dscacheutil -flushcache

Was this answer helpful?

« Back