- Open a text editor such as Notepad (all programs>accessories).
Windows 7 and later: Right-click on Notepad and select the option to Run as Administrator â€“ otherwise you may not be able to open this file. If you donâ€™t have the run as Administrator option it means you donâ€™t have these privileges. Contact your IT person to get them or to set up the local host for you.
- Locate the HOSTS file on your computer. Typically it is in one of the following locations:
- Windows NT/2000/XP/2003/Vista/7 â€“ C:windows/system32/drivers/etc/hosts
- Windows 95/98/Me â€“ C:windowshosts
- Then, open the file. Consider performing a â€œSave Asâ€ so you have an original copy of the file that you can restore later. You will see two columns of information, the first containing IP addresses and the second containing host names. By default, a windows hosts file should be similar to the following:
(In Windows 7Â Press and holdÂ Ctrl+ShiftÂ while opening the Notepad/Wordpad).
You can add additional lines to this file that will point requests for a particular domain to your new serverâ€™s IP address.
- Save your changes (be sure to save as a host file, not as a text file).
Windows wants to save it as text (.txt) so you need to
- Change save as type to all files and then
- Click on host Â (the original file).
- Restart any currently open browsers.
- You may also want to flush your DNS cache. In Windows XP, go to Start, and then Run, then type â€œcmdâ€ and hit enter.
Type the following:ipconfig /flushdns
- In your web browser you should see your site as it appears on your testing server when typinghttp://example.com/ but still be able to see the site on its current web server by visiting http://www.example.com/