Preview site before switching DNS with your hosts file (Windows)

If you are moving your website to a new server and would like to test it before you go live, there are several ways to do this, including using a temporary URL.  The downside to a temporary URL is that some scripts will automatically redirect the web browser to your "primary" domain. The way to view and interact with your site exactly as if it were pointed to the server is by modifying your hosts file. The following is on Windows 7, but the procedure is very similar on all versions of Windows. You will need to have administrative access on the workstation you are using to edit the hosts file. 

1. Start by opening notepad as an administrator. Find notepad under All Programs>>Accessories or type it in the search box. Right-click on the shortcut and select "Run as administrator".

Confirm the action or enter your password in the box that pops up.

2. In Notepad, select File >> Open... Navigate (or paste the path) to C:\Windows\System32\drivers\etc

Make sure you change the drop-down at the bottom right of the window to "All files" as shown:

3. Open the file called "hosts". You will add a line with your web site address and its IP address.  You can retrieve your site's IP address via your control panel interface, or contact Sectorlink support.  At the bottom of the file add a line like the following:

Then save the file.

4. You will then need to close your browser windows and re-open them.  From there, browse to your site normally (i.e. ) to preview it under your Sectorlink hosting account.  This change will affect any browser on your local workstation.  Remember to remove the entry from the hosts file once you are done testing. 

Was this answer helpful? 0 Users Found This Useful (669 Votes)