Skip to content

Instantly share code, notes, and snippets.

@djaiss
Last active July 20, 2024 05:34
Show Gist options
  • Save djaiss/85a0ada83e6bca68e41e to your computer and use it in GitHub Desktop.
Save djaiss/85a0ada83e6bca68e41e to your computer and use it in GitHub Desktop.
Block Twitter/Facebook in your /etc/hosts
# Block Facebook IPv4
127.0.0.1 www.facebook.com
127.0.0.1 facebook.com
127.0.0.1 login.facebook.com
127.0.0.1 www.login.facebook.com
127.0.0.1 fbcdn.net
127.0.0.1 www.fbcdn.net
127.0.0.1 fbcdn.com
127.0.0.1 www.fbcdn.com
127.0.0.1 static.ak.fbcdn.net
127.0.0.1 static.ak.connect.facebook.com
127.0.0.1 connect.facebook.net
127.0.0.1 www.connect.facebook.net
0.0.0.0 meta.com
0.0.0.0 www.meta.com
# Block Twitter
127.0.0.1 www.twitter.com
127.0.0.1 twitter.com
127.0.0.1 apps.facebook.com
# Block Facebook IPv6
fe80::1%lo0 facebook.com
fe80::1%lo0 login.facebook.com
fe80::1%lo0 www.login.facebook.com
fe80::1%lo0 fbcdn.net
fe80::1%lo0 www.fbcdn.net
fe80::1%lo0 fbcdn.com
fe80::1%lo0 www.fbcdn.com
fe80::1%lo0 static.ak.fbcdn.net
fe80::1%lo0 static.ak.connect.facebook.com
fe80::1%lo0 connect.facebook.net
fe80::1%lo0 www.connect.facebook.net
fe80::1%lo0 apps.facebook.com
@cybervigilante
Copy link

Still can't block $#@!$# Twitter with the full list. It's like some kind of evil leech. Thank God Dorsey is leaving. What really stinks is they blocked my account but you can't delete your account if it's blocked so I am stuck with that horror Forever.

@cybervigilante
Copy link

I finally blocked Twitter with a Chrome app, but for some odd reason the blank page I get still has that stupid bird.

@gabrieldocoutos
Copy link

I was also having trouble with Twitter. How I fixed:

  • Go to Twitter
  • Open developer tools, go to the application tab
  • Click on "clear site data"

After that, Twitter was not able to load anymore

@enrico223
Copy link

In addition to that, I also added 0.0.0.0 api.twitter.com

@ambiamber
Copy link

ambiamber commented Jul 1, 2023

If you are using Pi-Hole for blocking just Facebook, you can plug these into the admin web console as wildcard domains:

facebook.com
facebook.net
fbcdn.com
fbcdn.net
fbsbx.com
fbsbx.net
fburl.com
fb.me
fb.com
m.me
messenger.com

Pi-hole wildcard domains match on regex like: (\.|^)facebook\.com$

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment