Knowledgebase: Network Tips
How do I change hosts file to preview domain before DNS changes propagate?
Posted by PremiumReseller.com on 08 May 2009 12:41 AM

To see your domain on our server before a DNS change takes effect, please configure hosts file on your computer as below

1. Edit hosts file on your PC

"Hosts" file is located in folder C:\WINDOWS\system32\drivers\etc

Verify that the file is not "read only" by right clicking it, and choosing it's Properties.

Then open the file for editting with Notepad. There should already be an entry for "localhost". Follow that format to insert your domain and server IP.

127.0.0.1 localhost

111.222.333.444 www.example.com

Then save the hosts file and close notepad.

You can verify domain ip by ping the domain in command prompt window.

Run command ipconfig /flushdns to clear dns cache on your computer if domain ip is not updated.

You may also have to reboot for the change to take effect. Next time you go to "www.example.com", web browser will try to find that domain at the corresponding IP instead of looking up the IP through DNS.

2. Edit Hosts file on Mac

Mac OS 9's hosts file format is based on RFC-1035.

Mac OS 9 keeps its HOSTS file in the Preferences folder under the System folder. Edit this file and add a line for each host that you would like to map an IP to:

www.example.com 204.11.246.1

To find the hosts file in OS X's graphical interface:

+ Open Finder.

+ In the Go menu, select "Go to Folder"

+ Type /etc for the folder name.

+ In the list of files that appears, you should find hosts. Double click it to open it in a text editor.

+ As in the earlier examples, the format of the file is: "204.11.246.1 www.example.com".

On unix-based systems, as well as OS X's terminal, you can find the hosts file at /etc/hosts.

(322 vote(s))
This article was helpful
This article was not helpful