How to update your hosts file on Mac and PC

During development of websites it’s often typical to develop under your existing domain name (ie. www.your-project-domain.com) both locally (on a desktop) and/or on another server with its own IP address while at the same time keeping your existing website running on an existing server.

In order to view the development site at its real domain (ie. www.your-project-domain.com) you will want to update your hosts file in order for your computer to use the ip/host you specific instead of relying on public DNS.

These are the two publicly available tutorials that are most up-to-date and have been tested by our clients most recently:

A typical hosts file entry for a new server IP would look like:

72.47.228.191    www.your-project-domain.com    your-project-domain.com

A typical hosts file entry on your localhost would look like:

127.0.0.1    www.your-project-domain.com    your-project-domain.com

Following the instructions above should allow you to see the version of your website hosted on another server or on your local machine. (For most client’s of Red Bridge Internet you will be pointing to an IP that we’ll provide you).

Alternatively, you should be able to ping the domain when you’re done and see the correct IP be returned:

That’s it. Following these instructions should allow you to edit your computer’s hosts file; either Mac or PC, to see you version of your website or the the current website project at an alternative domain then the one your site is currently hosted at.

 

Post written by Ed Reckers

Founder and lead web development consultant at Red Bridge Internet : San Francisco WordPress Developers and Consultants.

Leave a Reply