MacOS – Some sites not blocked, /etc/hosts

hostsmacossafari

macOS layman here,

I'm trying to block websites natively with mixed results through Terminal using sudo nano /etc/hosts

My syntax is

127.0.0.1 www.website.org
::1 www.website.org

I've tried various iterations, with space, with tab, but there's a pesky little website that I can't manage to block.

eg. I've blocked lichess.org but haven't managed yet to block 4chan.org. I've searched the web but I didn't get any wiser. I don't understand how I can block one site with exactly the same syntax but I can't block another.

macOS Big Sur Version 11.2.3 (20D91) / Safari Version 14.0.3

Ideally I would like to do this on the back end without using Screen Time or Parental Control. Any help is appreciated.

EDIT:

127.0.0.1       www.4chan.org
127.0.0.1       4chan.org
127.0.0.1       https://www.4chan.org
127.0.0.1       https://4chan.org

127.0.0.1       https://boards.4channel.org
127.0.0.1       https://boards.4chan.org


::1             www.4chan.org
::1             4chan.org
::1             https://www.4chan.org
::1             https://4chan.org

::1             https://boards.4channel.org
::1             https://boards.4chan.org

Best Answer

The hosts that are not being blocked successfully are probably already in your DNS cache.

Try clearing the cache using:

sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder

if you are on Big Sur (looks like you are), or:

sudo killall -HUP mDNSResponder

if you are running Catalina, Mojave, High Sierra, or Sierra.

You may also need to clear the browser cache. For Safari, go to Safari -> Preferences -> Advanced and turn on "Show Develop menu in menu bar". Next, in the Develop menu, chose "Empty Caches"