Preview a website through your local hosts file

For different reasons you might need to preview your website before updating your DNS servers using your local PC hosts file.

Hosts file

Adding entries to your hosts file lets you view the files you uploaded to your hosting account before changing your domain's nameservers.

To do this, add your hosting account's IP address as an entry on your computer's host (your computer). 

Where that files is depends on your operating system (OS):

  • Windows (8, 7, XP, etc.) the file is c:\windows\system32\drivers\etc\hosts

  • Macintosh OS X the file is /etc/hosts

  • Linux - the file is /etc/hosts

Now, add an entry for your domain/hosting account using the following format:

[your account's IP address] [your fully qualified domain name]

For example:

12.0.0.1 cool-example.com

You can also add the www version of your domain. You can add that version to the same line, like so:

12.0.0.1 cool-example.com www.cool-example.com