Using Windows Hosts file to prepare for website launch

As a web developer you often don't have access to internal DNS servers to test websites that you are working on.
As an alternative we can use the Windows Host File.  This allows me to use internet Explorer to view the actual URL without making it live on the internet.
This allows me to test and configure the site using the correct base URL as it awaits domain propagation.

To make the required changes to your hosts file the following steps should be completed:

Step 1 - On a Windows machine click the Start button and in the Accessories folder find Notepad – but don’t left click it open, instead right click for a menu that includes the option to “Run as administrator” – select this and Notepad will open.
The reason we do this is that on windows Vista and Windows 7 computers the host file cannot be edited using regular permissions so Run As Administrator is required.

Step 2 - Use the File menu in Notepad to select Open… then browse to %systemroot%\System32\drivers\etc – you will probably see a blank folder and this is because by default Notepad is set to look for files of type .txt – so using the drop down there select All Files (*.*) which will reveal the files without extensions, you should now see a file called “hosts” – open this file

At the bottom of the file insert your hosts directive which has the format of IP-address space domain-name, for example:

(do *not* use www. in your domain name!) once you have inserted this line click Save and close Notepad.

Now when you enter this domain name, without the www. part, in any of your browsers it will direct your request to the IP address you specified. To view the actual website the domain is pointing to before you switch it to the new server just use the www. in front of the domain e.g. – this will bypass your hosts directive.

Comments (5)


Hi - this is my blog - I am Alistair Macdonald - I thought this would be a useful article for here.

What do you need from me to prove that it's my blog?




I have just updated my EE profile with my real name and site URL (, just realised you would find it hard to make the connection (although my registered gmail address does use my real name  - feel free to use the contact form on that site to get a confirmed response or email me at - alternatively I could update the blog article in question on my site in any way you wish!

Thanks, I do understand your need to do this!



I have just added a small rider to the about page on my blog to confirm that I am on EE as blueghozt - - hope this clears it up!


thanks for your comments - the reason I propose the opening through notepad is that you can launch notepad with administrator priviliges and then browse to the hosts file - when I paste in the path to windows explorer I can find the file and open it but cannot save it as I do not have administrator priviliges, I thought this was an important point. This way works for me and my many clients with varying technical abilities, we are able to view the site at or within seconds of doing this.

I will await the PE verdict!


fine with that :)

Have a question about something in this article? You can receive help directly from the article author. Sign up for a free trial to get started.

Get access with a 7-day free trial.
You Belong in the World's Smartest IT Community