MacOS – Sites blocked in /etc/hosts often doesn’t work

firefoxgoogle-chromehostsmacossafari

I'm using a Macbook Pro as a productivity/work machine and have Facebook and reddit blocked with /etc/hosts:

##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting.  Do not change this entry.
##
127.0.0.1       localhost
255.255.255.255 broadcasthost
::1             localhost 
fe80::1%lo0     localhost
0.0.0.0         facebook.com
::0             facebook.com
0.0.0.0         reddit.com
::0             reddit.com

This has worked for a while in all browsers, but recently stopped working in Firefox and Safari, and I can't figure out why. I was previously using 127.0.0.1, but when that stopped working I tried 0.0.0.0 instead, no dice.

I did install Avast just recently so I thought that could have been the problem, what with its web security features, but I uninstalled the browser add-on in Safari and Firefox and I was still able to access Facebook and reddit just fine.

And I just tried uninstalling the add-ons again, and restarted the computer. Now, Google Chrome can access Facebook, but not reddit. Firefox can't access either, and Safari can access both…

I'm using OS X 10.7.5.

Best Answer

I solved my problem. It seems I need to block both the domain website.com and the address www.website.com. I didn't know that was necessary. I edited them in there and now the blocking is consistently working everywhere.