Knowledgebase
Previewing your web site by editing your hosts file
Posted by zz-James Moir on 21 June 2016 04:07 PM

Issue

For various reasons it may be necessary to update the Hosts file on your computer to properly resolve a web site by its domain name. The most common reason for this is to allow you to view or publish web content immediately after purchasing a new domain name or transferring an existing domain name to our service.

New and transferred domain names have a delay 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 is generally unavailable.

If you need to preview your site immediately and cannot use the Plesk Site Preview feature then you can edit a file on your computer as a temporary work around.

Solution

Windows & Mac contain a file called 'hosts' that will force resolution of your domain name. Edit this file using the following procedure.

Click here for instructions for Windows or Mac instructions.

Windows 

1. Locate the hosts file on your computer

Use Windows explorer to navigate to the following directory:

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

Windows NT/2000 c:\winnt\system32\drivers\etc\hosts

Windows XP Home/Pro c:\windows\system32\drivers\etc\hosts

2. Open the hosts file for editing

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



We will start typing on 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

Important Note

You must replace the 123.123.123.123 number with the IP Address of the web server detailed in your Net24 setup email. Replace 'yourdomainname.com' and 'www.yourdomain.com' with the domain name of your web site.

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


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

Mac OS X - Snow Leopard and Lion

1. Open the Terminal.app

Either by typing Terminal in the Spotlight, or by going into Applications -> Utilities -> Terminal.

2. Open the hosts file

Open the hosts by typing on the Terminal that you have just opened:

sudo nano /private/etc/hosts

Type your user password when prompted.

3. Edit the hosts file

The hosts file contains some comments (lines starting with the # symbol), as well as some default hostname mappings (e.g. 127.0.0.1