Browse All Articles > 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:
23.23.253.12 domain.com
(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. www.domain.com – this will bypass your hosts directive.
Comments (5)
Author
Commented:What do you need from me to prove that it's my blog?
Thanks,
Ali
(ali@nubz.com)
Author
Commented:Thanks, I do understand your need to do this!
Ali
Author
Commented:Author
Commented:I will await the PE verdict!
Author
Commented: