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 www.yourdomain-one.com
208.0.0.0 yourdomain-two.com www.yourdomain-two.com

You can see from the above example there are two records listed pointing to the server IP "208.0.0.0", each line in the example is a domain name with its non-www and www record. This makes it simple to read, but you can have as many domains with a space between each one on a single line, for example:

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

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


Was this answer helpful?

« Back