Develop and test a web site before domain propagation

Did you know that there is a very handy method to allow you to view and test your new or updated web site  before submitting a DNS change request to your registrar? This simple addition to the “hosts” file on your PC or Mac re-direct any internet requests to the IP address of your choice, for example a new server, directory, or sub-domain.

Simply add this code to your hosts file. That’s it.

127.0.0.1    yoursite.com
127.0.0.1    www.yoursite.com

Now, whenever you browse to your domain name you will be re-directed seamlessly to your development server.

Setting up the Hosts file on a PC

  1. Click the Start Menu button and then type the word “notepad” in the Search area.
  2. Right click on the “Notepad.exe” icon that appears and choose “Run as administrator
  3. Click “File > Open” using Notepad and navigate to the “Windows > System32 > drivers > etc” directory.
  4. Click the drop-down field titled “Files of type:” and choose “All Documents (*.*)”
  5. Open the file titled “hosts
  6. Add the following entries at the end of the Hosts file:127.0.0.1    yoursite.com
    127.0.0.1    www.yoursite.com

  7. Save this “hosts” file. Note: Click through any warnings that pop up, if any.
  8. Reboot the computer.

Setting up the Hosts file on a Mac

  1. Look in the System Folder: Preferences and also in the System Folder for a file named “Hosts“. If it does not exist, create this file using a text editor.
  2. Add the following entries into the Hosts file:127.0.0.1    yoursite.com
    127.0.0.1    www.yoursite.com

  3. Save this Hosts file into the System Folder: Preferences
  4. Reboot.

If you have an older Mac that is using MacTCP instead of Open Transport, you may need to put the Hosts file in the System Folder.

Share/Save