How to edit hosts file Print

  • 0

Some sites cannot be tested properly using the Preview link due to limitations or restrictions within the website code. To test the site prior to making it live you can edit the hosts file in your Windows PC. This will simulate the site being live only on this PC.

Before you begin, you will need:

To edit the hosts file:
  1. Find Notepad (by default this is located in Start > All Programs > Accessories) and right-click it > Run as administrator
  2. When prompted "Do you want to allow the following program to make changes to this computer" click Yes
  3. Once Notepad opens click File > Open
  4. In the File name field enter "%systemroot%\system32\drivers\etc\hosts" > click Open
  5. Scroll to bottom of the document and add the following two new lines:
    [IP of the web site] domain.tld
    [IP of the web site] www.domain.tld
  6. Click File > Save
  7. Locate Command Prompt (by default this is located in Start > All Programs > Accessories) and right-click it > Run as administrator
  8. When prompted "Do you want to allow the following program to make changes to this computer" click Yes
  9. Once Command Prompt opens enter "ipconfig /flushdns" without quotes and press Enter
  10. Open a new web browser window (simply opening a new tab in a browser already opened may not suffice)
  11. Test your site by navigating to http://www.domain.tld

Important: It's recommended that you verify you are testing the correct site by looking for content or design changes that would only exist on the new site being tested.


Once you're done testing and to undo the changes, repeat all steps however in step 5 remove the two lines that were added.


Was this answer helpful?

« Back