I need to block a particular website on my Mac (OSX 10.11.1, El Capitan).
I have already made the changes to /etc/hosts but the website is still not blocked when testing from Chrome. I think this has to do with it being an HTTPS connection.

Procedure:

Using sudo nano /etc/hosts, I have modified the /etc/hosts file to add the following lines: 0.0.0.0 goodreads.com 0.0.0.0 176.32.103.85

I checked the changes with cat /etc/hosts. Then I flushed the DNS cache using sudo killall -HUP mDNSResponder and sudo dscacheutil -flushcache. I then try to access the page from within Chrome and it succeeds. I have also rebooted the machine, but the connection still succeeds.

It seems that this should work. I have searched extensively, and this approach is the most recommended. What am I missing?


Solution 1:

Please use the following hosts file entries:

##
# 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
127.0.0.1       goodreads.com www.goodreads.com www1.goodreads.com
255.255.255.255 broadcasthost
::1             localhost
fe80::1%lo0     localhost

To properly block websites with the hosts file you also have to include aliases like www, ww1, www1, mail etc.