How do I change my hosts file?

You are likely asking this because you want to see your domain name before your DNS changes propagate. Reminder: You normally need to wait 48 hours for propagation to complete.

Here is an advanced process for forcing your computer to see the site, early:

Windows XP and lower Edit your hosts file on your PC.

If you are using Windows, use "Start", "Find", "Files and Folders" to find a file in your windows directory (or WINNT\system32\drivers\etc) called "hosts". Verify that the file is not "read only" by right clicking it, and choosing it's Properties. Then open the file for editing with Notepad. There should already be an entry for "localhost". Follow that format when you insert your domain and our IP.

On Windows98 and Windows95, the order may be 'hostname' then 'IP address'. On Windows2000 and WindowsME, the order is 'IP address' then 'hostname'

127.0.0.1 localhost

174.132.123.138 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.

Windows 7 or Vista Edit your hosts file on your PC.

  1. Browse to Start -> All Programs -> Accessories
  2. Right click "Notepad" and select "Run as administrator"
  3. Click "Continue" on the UAC prompt
  4. Click File -> Open
  5. Browse to "C:\Windows\System32\Drivers\etc"
  6. Change the file filter drop down box from "Text Documents (*.txt)" to "All Files (*.*)"
  7. Select "hosts" and click "Open"
  8. Make the needed changes and close Notepad. Save when prompted.

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. On recent versions of mac OSX, including snow leopard, the hosts file is located at /private/etc/hosts. Edit this file and add a line for each host that you would like to map an IP to:

www.example.com 174.132.123.138

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

  1. Open Finder.
  2. In the Go menu, select "Go to Folder"
  3. Type /etc for the folder name.
  4. In the list of files that appears, you should find hosts. Double click it to open it in a text editor.
  5. As in the earlier examples, the format of the file is: "204.11.246.1 www.example.com".

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


Once you have modified your hosts file, you can flush your DNS so that you can see your new changes more quickly. Do this from the command line.

Was this answer helpful?

 Print this Article

Also Read

Will you place ads on my site?

AdriaHost.net will NOT place ads on your site. That is one of the many advantages of having a...

How do I move my Wordpress blog from one host to another?

Before you start...If you are a new AdriaHost customer, or you are upgrading your AdriaHost...

Will my email accouts be transferred as well?

If your previous hosting company uses cPanel, then we can migrate your current email boxes...

Can I password protect directories?

Yes, you can password protect directories within cPanel.

What control panel do you use and do you have a demo?

All AdriaHost servers use cPanel. You can try the demo here. Username: x3demob Password:...