/etc/hosts) that your DNS server checks before it sends a request to the remote server. If you want to override an address to block ads or setup a server before it’s resolving to the Internet you can modify the hosts file.

The Easy Way:
Open NetInfo Manager (Applications -> Utilities) and select machines. Click the lock icon and enter your password to modify the list.
Select localhost and click Duplicate. Change the ip_address field to the address you want and the name field to the hostname you want the ip to resolve to.
Go to Domain -> Save or hit to save the changes. You can now enter the hostname into your browser and it should direct you to the ip address.

The Other Way:
I say the other way because it’s just about as easy, just requires a little terminal work. Open Terminal and type sudo su to gain root access. Now you can edit /etc/hosts and add the line you need.
pico or vi /etc/hosts and add the following line: 127.0.0.1 example.domain.com. Replacing the values as you see fit.
Exit out of your editing program and save the changes. You should be all ready to access your domain now.
On Windows the file is located:
Windows NT/2000/XP Pro c:\winnt\system32\drivers\etc\hosts
Windows XP Home c:\windows\system32\drivers\etc\hosts

Trackback
[...] Do not wait until the next DNS update and change your host file in Mac OS X [...]
October 2nd, 2007 at 1:49 pmdoug rogers
Trackback
[...] like. Afterwards, add that host to your hosts file. Here’s how to do it in Windows, Linux or Mac OS X. If all goes well, enter the new URL (including /install in the end) in your browser, and you [...]
October 2nd, 2008 at 6:30 pm