How To Edit Your Hosts File

In order to easily interact with our hosting service it can be helpful to temporarily point domain names to our server's IP address for testing purposes before going live with our service. Normally a request for a domain through your web browser receives a response from an authoratative DNS server pointing you to the appropriate IP address for the domain.  This means that if your domain name is pointed to your existing website, and you're creating a test website here, when you type in the domain name you'll see the existing site unless you change your computer's hosts file or use a browser plugin to repoint the domain name tempoarily for you.


Browser Plugins


The easiest method to try out, before resorting to editing your hosts file, is a browser plugin that mimics the same behavior. The following plugins should be able to help you test how your domain will work before updating your domain registrar's DNS to point to our servers.


Edit System Hosts File


If you have just signed up for hosting and your site is currently located somewhere else, you'll need to make a change to your computer before you can upload your site via the domain name.


You need your computer to think your domain name is associated with an IP address here, on your new hosting account, so it won't redirect you to your live site's existing hosting account.

To do this, you need to edit your computer's HOSTS file.

When modifying your hosts file, you'll be adding two entries that contain the IP address that you want the site to resolve to, and the domain. Adding the following two lines, for example, point www.yourdomain.com and yourdomain.com to our main server on your computer:

67.225.165.30 www.yourdomain.com
67.225.165.30 yourdomain.com

User Account Control (UAC) prevents non-administrator users from editing the Windows hosts file so Windows 10, Windows 8, Windows 7, and Windows Vista users must run Notepad as Administrator.


Windows 8 and 10

  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. Click File > Open, insert the following in the File Name field: C:\Windows\System32\Drivers\etc\hosts
  5. Click Open
  6. Add our service's IP Address and the domain name you set up with our service
  7. Remember to replace yourdomain.com with your domain name, 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 UAC window
  4. Click File > Open, insert the following in the File Name field: C:\Windows\System32\Drivers\etc\hosts
  5. Click Open
  6. Add our service's IP Address and the domain name you set up with our service
  7. Remember to replace yourdomain.com with your domain name, Click File > Save to save your changes

Windows XP and Earlier

  1. Click Start > All Programs > Accessories > Notepad
  2. Click File > Open, insert the following in the File Name field: C:\Windows\System32\Drivers\etc\hosts
  3. Click Open
  4. Add our service's IP Address and the domain name you set up with our service
  5. Remember to replace yourdomain.com with your domain name, Click File > Save to save your changes

Mac OSX

Open the Terminal by typing Terminal in Spotlight or by going to Applications > Utilities > Terminal
Open the hosts file by typing in the Terminal application:

sudo nano /private/etc/hosts

In some instances the hosts file will have locked permissions. If that's the case use the following command instead:

sudo chflags nouchg /private/etc/host

You will have to type your user password when prompted.

Add your new mappings underneath the default ones, you can navigate the file using the arrow keys
When you are done editing the hosts file, press Control-o to save the file
Press Enter on the filename prompt, and Control-x to exit the editor

Follow Up

Your system should now begin resolving to the specified IP address. After you're done with testing remove these entries.
  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

My site's down!

If you cannot view your website, here are a few things to check: Has your domain expired? If...

Do I Need a Shopping Cart for Online Sales?

Most online merchants use shopping cart software to make the sales process easier for customers....

Are there any set-up fees?

Yes. There is a one-time set-up fee of $19.95 to establish your hosting account. Once you have...

How do I pay for my account?

We accept MasterCard, Visa, AMEX, and Discover. If you put a card on file, we will use that card...

What if I want to upgrade my account?

It's easy! Login to your account at https://secure.hostingct.com/billing and Submit a Ticket. If...

Powered by WHMCompleteSolution