Update your local hosts file to see a website in development

To see a website that is still in development, you will need to change the local hosts file on your computer. By pointing the website domain name at the development server’s IP, you are able to visit the website on your computer. This is a nifty way that we can develop the website live on the internet, but keep the website private from any visitors.

On an Apple computer

Here are the instructions to change your hosts file on an Apple computer. The steps look intimidating, but it is actually just a bit of cut and paste. You can see the new website by updating your local hosts file. You will be unable to see your development website with these changes in place.

Open the terminal.

Open Finder and go to Applications -> Utilities -> Terminal.

Enter the following command.

$ sudo nano /private/etc/hosts

Add this to your hosts file:
111.222.333.444 yourdomainname.com
111.222.333.444 www.yourdomainname.com

Replace the IP and domain name with your info. You can navigate the file using the arrow keys.

Save the hosts file.

Press control-o to save the file, and enter on the prompt.

Press control-x to exit the editor.

Flush the DNS cache.

$ dscacheutil -flushcache

Reload the domain name in a browser to test if your edits were successful.

Hold Up... Is this too complicated? Get Help

On Windows 8

Follow the steps found here: http://www.howtogeek.com/howto/27350/beginner-geek-how-to-edit-your-hosts-file/

Paste this into your hosts file to see the new site:
111.222.333.444 yourdomainname.com
111.222.333.444 www.yourdomainname.com

Leave a Reply

Your email address will not be published. Required fields are marked *