127.0.0.1 localhost 204.11.246.1 www.example.com Then save this altered hosts file and close notepad. Make sure Windows did not silently save the file as "hosts.sam". The filename has to be "hosts". You may also need to reboot for the change to take effect. Next time you try to go to "www.example.com", your browser will try to find that domain at the corresponding IP instead of looking up the IP through DNS.
The Mac OS 9 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.
2) Or use this
other method instead.
Once you have modified your hosts file, you can flush your DNS so that you can see your new changes more quickly. Depending on your OS, there are different ways to do this:
- For Mac OS X the command is:
lookupd -flushcache
- For Windows the command is:
ipconfig /flushdns