This article explains how you can quickly and easily edit your .hosts file in Windows.

A hosts file is a plain-text file used by your Windows PC to map hostnames to IP addresses.

Modifying your computers hosts file is a useful if you wish to preview your website on Ecenica without modifying your domain name. Editing your hosts file can also be useful after registering a new domain name, recent domain transfer or DNS update. See How long does it take for my domain name to become active?

How does it work?

When you view a website your computer looks at it’s .hosts file to try and map the site host-name to an IP address. If a match is not found, your computer tries to find an IP address using the Domain Name System (DNS).

Editing your .hosts file let’s you intercept the DNS lookup and redirect your domain to another IP address.

The computer at the receiving IP address needs to answer to your domain name.

Why update my .hosts file?

  • Easy migration. You can publish and test your site on your Ecenica web space without taking your old site offline.
  • Faster web development. You can develop and test your site on your local server using your domain name.
  • Redirect your domain to a local IP address.
  • Simple and easy to use.

How do I change my .hosts file?

To view your website before updating your domain’s name servers or DNS records you will need to change your HOSTS file to point to your Ecenica IP address (Computer).

Microsoft Windows

  1. Click Search the web and Windows
  2. Type Notepad
  3. Right-click Notepad and select Run as administrator
  4. Click Yes on the User Account Control prompt
  5. In Notepad, click File > Open
  6. Change the file filter drop down box from ‘Text Documents (.txt)’ to ‘All Files (.*)’
  7. Right-click the address bar and select Edit address
  8. Type C:\Windows\System32\Drivers\etc and press the Enter key
  9. Select the hosts file and click Open.
  10. At the bottom of the file, insert your Ecenica web servers IP address and your domain name. For example:
  11. Close Notepad. Click Save when prompted.

Example hosts file with added.

# Copyright (c) 1993-2009 Microsoft Corp.
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.

#My Ecenica Websites

Flush DNS

After you’ve changed your hosts file we recommend you flush your DNS. This will make your PC pick-up the new changes faster.

  1. Click Start.
  2. Type cmd.
  3. Right-click Command Prompt and select Run as administrator.
  4. Click Yes on the User Account Control prompt.
  5. Enter ipconfig /flushdns
  6. Press the Enter key.