How to block all domains with, for example, "google" as their second level domain.
For instance:
- block:
- google.com, google.net, google.org ...
- www.google.com, stats.www.google.com, www.google.net ...
- not to block:
- www.google.com.example.com
Blocking by second level domain
-
- Posts: 3
- Joined: Wed Aug 31, 2016 2:15 pm
Re: Blocking by second level domain
Yes, that rule blocks all it needs to block, but also blocks things I do not want it to block.
It block this example address: www.google.a.a.a.a.a.example.com .
I would like to block all domains with same second-level domain name but not top-level domain.
It block this example address: www.google.a.a.a.a.a.example.com .
I would like to block all domains with same second-level domain name but not top-level domain.
Re: Blocking by second level domain
To answer your literal question, you need a regex filter (replace example with your second-level domain):Below is a more complicated and optimized filter that covers even the authentication section of a URI and non-standard ports, and also covers Punycode representations of IDNs:A better idea might be to support a new wildcard for matching public suffixes (for example, what about google.co.uk?): https://en.wikipedia.org/wiki/Public_Suffix_List
uBlock Origin does this for hiding rules (called "entity-based cosmetic filters") re-using the common * wildcard, and I believe AdBlock for Chrome and Safari once did this (for hiding rules) with the pseudo-TLD tld: https://github.com/gorhill/uBlock/wiki/ ... ic-filters
I also thought one of the two allowed a similar wildcard in the $domain= option for blocking rules.
Code: Select all
/^(http|ws)s?\:\/\/([-\w]*\.)*example\.\w{2,}(\:|\/)/
Code: Select all
/^(?:http|ws)s?\:\/\/(?:[-\w%\!\$&'()*+,;=^\\|><"][-\w%\!\$&'()*+,;=^\\|><"]*(?:\:[-\w%\!\$&'()*+,;=^\\|><"][-\w%\!\$&'()*+,;=^\\|><"]*)?@)?(?:[-a-z\d_][-a-z\d_]*\.)*example\.[-a-z\d]{2}[-a-z\d]*\.?(?:\:\d\d{0,4})?\//
uBlock Origin does this for hiding rules (called "entity-based cosmetic filters") re-using the common * wildcard, and I believe AdBlock for Chrome and Safari once did this (for hiding rules) with the pseudo-TLD tld: https://github.com/gorhill/uBlock/wiki/ ... ic-filters
I also thought one of the two allowed a similar wildcard in the $domain= option for blocking rules.
Last edited by lewisje on Wed Oct 05, 2016 3:58 pm, edited 1 time in total.
There's a buzzin' in my brain I really can't explain; I think about it before they make me go to bed.
-
- Posts: 3
- Joined: Wed Aug 31, 2016 2:15 pm
Re: Blocking by second level domain
Thank you very much.
It works perfectly.
I agree filters should be more controllable, and a public suffix wildcard would be extremely useful.
It works perfectly.
I agree filters should be more controllable, and a public suffix wildcard would be extremely useful.