The hosts file is used by your computer to map locally IP address to domain names, thus overriding external DNS lookup. It resides in different places, depending on your operating system, but its format is the same throughout. 

It is useful when you want to test a migrated website before you change your DNS entries, or go live with SSL-enabled.

You need to add an entry to your hosts file that looks like the following: (replace the values with your Pressidium IP, and domain name): 

123.123.123.123 www.domain.com domain.com

The following sections provide instructions for locating and editing the hosts file on several operating systems.

  • Windows 8, Windows 7, and Windows Vista
  • Windows NT, Windows 2000, and Windows XP
  • Linux

Note: Don't forget to remove the entry, once testing is finished. 

Windows 8, Windows 7, and Windows Vista

Windows 8, Windows 7, and Windows Vista use User Account Control (UAC), so Notepad must be run as Administrator.

Windows 8

  1. Press the Windows key.
  2. Type Notepad in the search field.
  3. In the search results, right-click Notepad and select Run as administrator.
  4. In Notepad, open the following file: c:\Windows\System32\Drivers\etc\hosts 
  5. The file already contains some lines, add your line in the end of the file in a new line
  6. Click File > Save to save your changes.

Windows 7 and Vista

  1. Click Start > All Programs > Accessories.
  2. Right-click Notepad and select Run as administrator.
  3. Click Continue on the Windows needs your permission UAC window.
  4. When Notepad opens, click File > Open.
  5. In the File name field, type C:\Windows\System32\Drivers\etc\hosts 
  6. Click Open.
  7. If the hosts file contains entries, add yours at the bottom. 
  8. Click File > Save to save your changes.

Windows NT,  2000, and XP

  1. Click Start > All Programs > Accessories > Notepad.
  2. Click File > Open.
  3. In the File name field, type C:\Windows\System32\Drivers\etc\hosts 
  4. Click Open.
  5. If the hosts file contains entries, add yours at the bottom.
  6. Click File > Save to save your changes.

Linux

  1. Open a terminal window.
  2. Open the hosts file in a text editor (you can use any text editor) by typing the following line:  sudo nano /etc/hosts  
  3. Enter your password.
  4. The file already contains some lines, add your line in the end of the file in a new line
  5. Press Control+x.
  6. When asked if you want to save your changes, answer Yes.

Mac OS X 10.6 through 10.8

  1. Open Applications > Utilities > Terminal.
  2. Open the hosts file by typing the following line in the terminal window:  sudo nano /private/etc/hosts  
  3. Type your user password.
  4. If the hosts file contains entries, add yours at the bottom.
  5. Save it by pressing Control+x and answering Yes.
  6. Have your changes take effect by flushing the DNS cache with the following command:  dscacheutil -flushcache  

Did this answer your question?