Check to Make Sure a Domain is Working Before Redirecting the DNS Using Hosts File on Mac

I don’t know how this eluded me for so long…  I remember breaking MAMP a number of years ago by editing the hosts file on my Mac, and I think I have been afraid to edit that file ever since.

Tonight I needed to test out a domain before changing the dns.  I have the new site ready to roll – an add-on domain created in cPanel at a specific ip.  (Basically, I have ready to roll at an ip address of

The secret sauce was to go into my hosts file and add a line that says:

That’s it!  Now when I go to in a web browser on my computer, it displays the new site!  Pretty awesome!


Posted in

Toby Cryns

Toby Cryns is a freelance CTO, expert WordPress consultant, and teacher.

He offers free advice to improve your freelance biz.

He also publishes small droppings every now and then to and

Follow Toby's contributions on Github and