- Computers & Software»
- Computer How-Tos & Tutorials
Hosts File on XP
What's a Hosts File Anyway?
The hosts file is a little file well hidden on computer. Most people don't know they have one. But one day you may need to know.. A hosts file basically controls how your browser finds websites.
Websites have an address just like you do you might live at 123 Main Street. There may be multiple people living at that address - but you are Bob at 123 Main Stree. If you were a website you would have an address too: it would be something like 220.127.116.11 in fact if you type that set of numbers straight into your browser you will come up to a well known site: google.com. One of google's addresses is 18.104.22.168 - its called an IP address and every site has one. Some IP addresses belong to only one site, others will have many websites on the same IP address.
Sometimes though you may want to tempoarily change a website's IP address which is when you need to find your hosts file.
How To Test a New Website Before its "Live"
Think of his scenario - you have an existing website - but you want to change it over a new a hosting provider.On that new hosting provider you want to build an entirely new website. You want to build it, play with it, decide its right BEFORE you swap your website over to its new hosting and new look.
To do this you need to edit the hosts file on your computer. Temporarily you want to see your new site while the rest of the world keeps on seeing the old site.
To do this you need to know two things - the new IP address of your website and where you hosts file is on your PC.
You should know what the IP address of your website is from your hosting account.
To find you hosts file may be a little more difficult! Common locations for Windows machines are:
Windows 95/98/Me: c:\windows\hosts
Windows NT/2000: c:\winnt\system32\drivers\etc\hosts
Windows XP (Home OR Pro): c:\windows\system32\drivers\etc\hosts
When you find that file you want to add a single line to it:
22.214.171.124 mywebsite.com www.mywebsite.com
where 126.96.36.199 is your NEW IP adress and mywebsite.com is your domain
Step By Step Editing Your Hosts File
Step-by-Step Editing a Hosts File
If you're not confident editing a hosts file then follow this video along step by step - until they open up the hosts file in notepad. Ignore the bit about pinging to get an IP address.
Just add the ext ra line with
<new IP> <website name>
save and close.
Close your browser if you have it open
Restart your browser
You should see your new site (if you don' try ctrl-F5 to clear the cache)
When Things Go Wrong
If you find lots and lots of lines in your hots file its probably just your spywear program blocking sites by adding lines like
This is fine - ignore them - just add your line in and save.
You will need adminstrator rights to edit the hosts file - login in as admin if you are not already.
Your file may be read only - right click and change this before you open it with wordpad
Don't use anything but a text editor on a text file - Word will add all types of invisible rubbish to the file even if you save as text.
Dont try to save as the file - "helpful" windows will insist on calling in hosts.txt which is NOT the name it has to be hosts no extension. If you want to keep a copy - copy hosts to hosts-old before you start and then edit hosts and "save" it not "save as".
Oh and once your site is moved over to the new hosting don't forget to delete this line! Or copy back the saved hosts file to hosts!
This hub is for Sue who builds quality log homes and taught me a lot about hosts files!
More For The Technically Challenged By Lissie
- Affordable Small Business Websites Domain Names
This article is a jargon free guide to getting your small business visible on the Internet. Having a useful website can be a fantastic way to get free traffic to your business. Visitors to your website can come visit any time of the day or night and
- Online Business Models An Introduction
Don't do what I did - decide that I wanted to make money from home by making money online and start with a blank slate. Finally after 18 frustrating months I am starting to get there - but I wish I had read this article first - this is about why havi
- Microsoft Corporation
Get product information, support, and news from Microsoft.
- ZDNet: Tech News, Blogs and White Papers for IT Professionals
Where Technology Means Business: ZDNet delivers the best tech news, and resources for IT hardware, software, networking and services. It's the top site for IT managers and tech-savvy business people.
Startup and Technology News