Server Status
View Entry
Subject How to view my website before changing nameservers?
Author HelpDesk Staff

How Do I Change My Hosts File?

What Is a Hosts File?

The "hosts" file is used by your local computer's operating system to map hostnames to IP addresses. The hosts file is a plain text file, and is usually named hosts.

A typical hosts file will have one or more lines referencing your local computer (as 'localhost') and will resemble this: localhost


A hosts file can be edited to override your computer's network settings, and thus allow your computer to view a website prior to the DNS (domain nameserver) changes propagating.

Why Change the Hosts File?

Changing your hosts file is a temporary measure to preview your web site as it will load from your ET Web Hosting server. Modifying the host file lets you tell your computer to not look at the parent DNS servers for information on how to reach your domain name. Instead, you are telling your computer that the domain name is located at a specific IP address, and to use the address in your hosts file when you type the domain into your browser.

This is very useful for development purposes, as you can work on the site your hosts file points to without disturbing traffic to an existing site.

Once you are done developing and/or testing your new site using this method, you can update your name servers for your domain to point to your ET Web Hosting server, making the site live for all visitors. At that time you will want to also remove (or comment out) the line added to your hosts file, so you can be sure it's not masking any issues as the domain propagates to its new location.

NOTE: We recommend changing your hosts file over other methods for development purposes.It will provide you with the most stable testing environment, since it allows the site to be built on the intended domain name. Other methods, including the use of temporary URLs, can cause issues when changing the site's domain afterdevelopment. Numerous instances of your URL are used in database entries, for instance, and these may not be changed automatically when updating your site's URL.

Editing Your Hosts File

All operating systems will have a hosts file like our example: localhost


Add the second line in this example to your hosts file, with the following edits:

  1. Replace "" with your website's IP address.

    Note: To find your website's IP address, copy and paste the following link into your browser, and change "" to your domain name:

  2. Replace "" and "" with your actual domain name.

You may deactivate a line by prefacing it with a "#" (as in the third line above). This will cause the line to be ignored when the file is utilized.

Editing Hosts Files in Your Operating System

The following instructions are advanced steps for different operating systems.


Windows users are able to edit their hosts file directly on their PC.

Windows 8

  1. Select the Start key and locate Notepad. (If you do not see it on your current Start page, begin typing "Notepad" and a search box will appear on the right side of the screen with a list of programs under it. Notepad should be at the top of this list.

  2. Right click on Notepad. You will see options appear on the bottom portion of the Start Page.

  3. Select Run as administrator. 

    Note: Performing this action may cause Windows User Account Control to prompt you with a warning or, if you are logged in as another user, a request for the Administrator password. This step is necessary to modify system files such as the hosts file.

  4. Click File in the menu bar at the top of Notepad and select Open.

  5. Click the dropdown box in the lower right hand corner that is set to Text Documents (*.txt) and select All Files (*.*)

  6. Browse to C:WindowsSystem32Driversetc and open the hosts file.

  7. Make the needed changes, as shown above, and close Notepad.

  8. Save when prompted.

Windows 7 or Vista

  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:WindowsSystem32Driversetc.

  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, as shown above, and close Notepad.

  9. Save when prompted.

Windows XP and Earlier

  1. Browse to Start > Find > Files and Folders.

  2. Select the hosts file in your Windows directory (or WINNTsystem32driversetc).

  3. Verify that the file is not "read only" by right-clicking it, and choosingProperties.

  4. Open the file for editing with Notepad.

  5. There should already be an entry for "localhost." Earlier versions of Windows have different formats for hosts file entries. Be sure to follow the same format as you find in your file when inserting the ET Web Hosting server IP and the domain name:

On Windows 98 and Windows 95, the order may be hostnameIP address.

On Windows 2000 and Windows ME, the order is IP addresshostname.

  1. Make the needed changes and close Notepad.

  2. Save when prompted.

You may also need to reboot for the change to take effect. The next time you visit your domain, your browser will try to find the domain at the corresponding IP instead of looking up the IP through DNS.

Mac OS X

Follow the instructions below to edit your hosts file if you are running Mac OS X.

  1. Open the Terminal application. Start by typing Terminal on the Spotlight or by going to Applications > Utilities > Terminal.

  2. Open the hosts file by typing in the Terminal that you have just opened:

    sudo nano /private/etc/hosts

    Note: Some versions of Mac OS X will lock permissions on the hosts file (the file is marked as immutable). In the event this happens, use the following command instead: sudo chflags nouchg /private/etc/host

  3. Type your user password when prompted.

  4. The hosts file contains some comments (lines starting with the # symbol), as well as some default hostname mappings (e.g. localhost). Simply append your new mappings underneath the default ones. You can navigate the file using the arrow keys.

    Replace "" with your web server's IP and with your actual domain name. Additional domains, subdomains or addon domains (such as can be added at the end of the line, separated by spaces.

  5. When done editing the hosts file, press Control-o to save the file.

  6. Press Enter on the filename prompt, and Control-x to exit the editor.


On Unix-based systems, you can find the hosts file at /etc/hosts. Most distributions of Unix will have terminal located in the same location.

To open the terminal:

  1. Go to Menu.

  2. Select Applications.

  3. Choose Accessories.

  4. Select Terminal.

To edit the hosts file:

Unix users can edit hosts files in the same process as Mac users. Please refer to steps 2 through 4 in the Mac section above.


TeamViewer Remote Desktop Support