Why is Safari ignoring my /etc/hosts file?
I had a slightly different version of the same problem, and thought I'd mention what worked for me.

I develop websites.  To do that, I have a complete copy of each site running on my local network.  When I wish to work locally, I have always just added an entry for "example.com" to my local /etc/hosts file, and that has always overridden DNS, making it possible for me to access the local copy of the website in any browser, including Safari and Firefox.  I can work without affecting the actual live site, then upload changes when they're complete.

Recently, however, this technique stopped working for both Safari and Firefox, but not for Chrome, so for a while I was limited to using Chrome for local development.  I searched google and tried all the suggested fixes -- CR at the end of the hosts file, only one entry per line, various Firefox configuration changes using "about:config", etc.  Nothing worked.

Then I tried this simple thing:  in addition to putting the IPV4 version of the address in the /etc/hosts file, I also put the IPV6 version.

Before:

10.0.1.23       example.com


After:

10.0.1.23       example.com
0:0:0:0:0:FFFF:0A00:0117        example.com


As soon as I added the IPV6 entry, both Firefox and Safari started hitting the correct (local) server.

There are various websites that will translate IPV4 addresses to IPV6; just do a google search on "ipv4 to ipv6".