Home -> Knowledgebase -> Hosting -> Previewing Your Web Site
Previewing Your Web Site

How to preview your website using your 'hosts' file

New and transferred domain names have a propagation period that can be anywhere from a few hours to a few days. During this period of time the new or transferred domain information propagates around the internet, and you can't see your new webspace.

Top Tip from 2020Media

If you need to preview your site immediately you can edit a file on your computer as a temporary work around.

Use your Hosts file

Windows contains a file called 'hosts' that will enable resolution of your domain name to the web server. Carefully edit this file using the following procedure.

1. Locate the hosts file on your computer

Microsoft Windows:

 

Navigate to the following directory using Windows explorer or similar:

Windows 95/98/Me c:\windows\hosts

NT, 2000, XP, 2003, Vista, 7, 8: C:\Windows\system32\drivers\etc\ 

 

Apple Macintosh:

Mac OS X and newer: /etc/hosts

 

Note in Windows 7 and above, you must open this with Notepad run as Administrator. To do this, click Start, click All Programs, click Accessories, right-click Notepad, and then click Run as administrator. If you are prompted for an administrator password or for a confirmation, type the password, or click Allow or Yes.

2. Open the hosts file for editing

Open your hosts file in Notepad. It should look something like this when you open it:

hostsfile1

Start a new line at the bottom of the file. To do so, click your mouse so that the cursor is at the very end of the last line and hit enter to start a new line.

Enter the following two lines of text like this example:

123.123.123.123 yourdomainname.com
123.123.123.123 www.yourdomainname.com


BUT, replace 123.123.123.123 with the IP address of your new website space. To find this out, contact Customer Services.

Your Hosts file should look something like this when you are done.

hostsfile2

 

Close the Hosts file and save it when asked. If your web browser is currently open, close it so that the changes take effect. It is not necessary to restart your computer.

You should now be able to view and publish to your web site using your domain name.

 

In the example, after saving the file, your browser will be automatically directed to the '123.123.123.123' IP address when navigating to either ‘http://yourdomain.com’ or ‘http://www.yourdomain.com’ .

 

Once you’re done working on the development or test sites, you’ll need to remember to remove the entries from the hosts file and save it in order to access the live sites again.