Web Design


 

How to set up your host file PDF Print E-mail

Sometimes we develop new web sites for clients that already has an existing web site. In these cases it is often important that the client can see the new web site, as it is being developed, while the general public still sees the old web site.

To enable this we can edit the host file. Here is how to do it.

If you are using Windows, use "Start", "Find", "Files and Folders" to find a file in your windows directory (or WINNT\system32\drivers\etc) called "hosts".

On most windows installations it will be located in: C:\WINDOWS\System32\drivers\etc\hosts

Verify that the file is not "read only" by right clicking it, and choosing it's Properties. Then open the file for editting with Notepad. There should already be an entry for "localhost". Follow that format when you insert your domain and our IP.

On Windows98 and Windows95, the order may be 'hostname' then 'IP address'. On Windows2000 and WindowsME, the order is 'IP address' then 'hostname'

Add the following line at the bottom of the file:

70.86.179.226 www.yoursite.com

Remember to replace www.yoursite.com with your actual web site address.

Then save this altered hosts file and close notepad. Make sure Windows did not silently save the file as "hosts.sam". The filename has to be "hosts". You may also need to reboot for the change to take effect. Next time you try to go to www.yoursite.com, your browser will try to find that domain at the corresponding IP instead of looking up the IP through DNS.

Mac OS 9's hosts file format is based on RFC-1035. Mac OS 9 keeps its HOSTS file in the Preferences folder under the System folder. Edit this file and add a line for each host that you would like to map an IP to:

www.yoursite.com 70.86.179.226

To find the hosts file in OS X's graphical interface:

Open Finder.

In the Go menu, select "Go to Folder"

Type /etc for the folder name.

In the list of files that appears, you should find hosts. Double click it to open it in a text editor.

As in the earlier examples, the format of the file is: "70.86.179.226 www.yoursite.com".

On unix-based systems, as well as OS X's terminal, you can find the hosts file at /etc/hosts.

Be aware that you will no longer be able to view your old site from the computer where you cange the hosts file (until you revert the hosts file back to it's original form).

 


© 2005-2006 Costa Tropical Internet - All rights reserved.
Powered by Joomla