When I develop web sites I like to have them run locally and responding to a more useful name than localhost/site. It used to be you could write rules in hosts pointing to It would seem you can't any more, as when I add a rule like Site typing "site" in the address window of the browser won't resolve to

Is there a way to get the hosts file settings respected or is there another method I can use instead?

  • Thanks. You're right. When I ping my sitename in hosts I get the local IP. However, it would seem browsers, Firefox and Safari in this case, first go to the internet for consulting and ignore what the OS thinks. So I end up on the net somewhere instead of on my local server. Maybe I need to change my network settings in the browsers? – MiB Apr 12 '17 at 16:41
  • I tried to flush the DNS cache with sudo dscacheutil -flushcache;sudo killall -HUP mDNSResponder, but that didn't help. Both Safari and Firefox still get out on the net. – MiB Apr 12 '17 at 20:02
  • 1
    Please add your web server software (including whether it's OS X Client/Server)|config and your hosts file to your question! You may obfuscate the host names but if you've set up several different sites use something like host1/2 // sld1/2 // tld1/2. – klanomath Apr 12 '17 at 20:16
  • Are you running native version of Apache which is pre installed or are using something else like Bitnami? I am running Sierra with no problems using my ip, localhost, and and a generic DNS. Also, are you using a router and are the correct port open and pointing to your local ip.. – norcal johnny Apr 13 '17 at 0:42
  • I was running MAMP (Apache + MySQL), but because I needed this time also get a self-signed certificate going I installed MAMP Pro trial which worked on the hosts file itself. It wrote website.com ::1 website.com and now Firefox doesn't go onto the net. I forgot what ::1 means, but I think it's IPv6 related. – MiB Apr 13 '17 at 10:31

You must log in to answer this question.

Browse other questions tagged .