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 mydomain.com ready to roll at an ip address of 220.127.116.11)
The secret sauce was to go into my hosts file and add a line that says: 18.104.22.168 mydomain.com www.mydomain.com
That’s it! Now when I go to mydomain.com in a web browser on my computer, it displays the new site! Pretty awesome!