Basically, your hosts file tells your computer where to find a particular website before it goes out to the internet to look for it. Quite often when you are developing a new website, you’ll need to change your hosts file to see the new version (this way the public can’t access it). Making changes to this file lets you tell your computer to look for your website in a different place than the general public.
If you locate the ‘hosts’ file on your computer (no extension) and open using Notepad, you’ll see a line that says something like:
Add a break, and add a new line below, such as:
To turn this off again, add a pound sign before the line (your computer will ignore these), or delete completely.
You may need to close and reopen your browser to effect the changes. Also, be aware the www. is relevant, if you go to mydomainname.ca, you’ll still see the old site in its ‘real’ location.
Here are some specific instructions for various operating systems:
Host File Locations:
Windows 3.1/95/98/ME c:windowshosts
Windows NT/2000/XP Pro c:winntsystem32driversetchosts or c:windowssystem32driversetchosts
Windows XP Home c:windowssystem32driversetchosts
By default, if you try to modify your hosts file in Vista, it will not let you save it. It tells you that you don’t have permission. To successfully modify the hosts file, run notepad.exe as an administrator and open the file.
1) Browse to Start -> All Programs -> Accessories
2) Right click “Notepad” and select “Run as administrator”
3) Click “Continue” on the UAC prompt
4) Click File -> Open
5) Browse to “C:WindowsSystem32Driversetc”
6) Change the file filter drop down box from “Text Documents (*.txt)” to “All Files (*.*)”
7) Select “hosts” and click “Open”
8) Make the needed changes and close Notepad. Save when prompted.
Mac OS X
Visit: http://www.evolt.org/article/Enabling_Virtual_Hosts_on_MacOS_X/18/13138/ for more information