How to change your local machines host file to preview your site Print

  • 2

There are two recommended way to preview your website without making any DNS changes on your domain. The easiest is to use a service such as SkipDNS to preview via the browser, the second is the more common way for developers and site owners to fully test their website, this is by changing your computers local 'hosts' file. Below you will find how to for both Windows and MacOS.

Windows Users

Open the file located on your computer: C:\WINDOWS\system32\drivers\etc\hosts in Notepad (run as administrator by right clicking on Notepad and select "Run as Administrator") and then copy the code and paste the code from the text area below or adjust the lines you require.

MacOS Users

On the top Mac bar select 'Go' and then select 'Go to folder', this will then bring a window up with a field which you will need to enter the following: /etc. This will direct you to the folder where you will need to open the file named hosts with TextWrangler (Download TextWrangler Here). Then copy the code and paste the code from the text area below or adjust the lines you require.

Example of hosts file below:

##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
##
127.0.0.1 localhost
# Change IP "208.0.0.0" and domain name (yourdomain-one/two.com) to point to Host Media servers from your welcome email.

208.0.0.0 yourdomain-one.com
208.0.0.0 www.yourdomain-one.com

208.0.0.0 yourdomain-two.com
208.0.0.0 www.yourdomain-two.com

As you can see from above, you have your non-www and www records now individually listed which is the recommended way, you can have these on one line but due to some newer operating systems and network configs sometimes they do not work, this is why we now recommend having them split out as shown above. 

Remember to comment out or remove the line once you have finished testing your website.


Was this answer helpful?

« Back