Preview Websites Before Making DNS Changes

If you are developing a new website you will often want to preview the website on its domain while keeping the old version running at the same time. Previewing the website allows you to properly test the website before going live and making DNS changes.

With Windows this is made quite easy by the use of the special ‘hosts’ file. You can add IP addresses that map to a domain that will override the actual DNS records. So for example if you are Google and developing a new version of www.google.co.uk you could add the following line to your hosts file:

127.0.0.1 www.google.co.uk

‘127.0.0.1’ is the internal IP address of your own computer (but could be any IP address) and would have the effect of loading your default website when browsing to www.google.co.uk!

The hosts file is located in the system32/drivers/etc folder:

C:\WINDOWS\system32\drivers\etc

On a Mac there should be a hosts file located in your private folder:

/private/etc/
This entry was posted in Tech and tagged . Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

Post a Comment

*
*
*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

* = Required