Skip to content

Domain lists

This document describes the syntax for domain lists. A domain list comes before a rule’s marker and restricts the rule to pages on the listed domains:

example.com,example.org##.ad-banner

The domain is taken from the hostname of the page’s URL. In an iframe, the domain is that of the iframe’s own URL.

A rule without a domain list is generic: it applies to pages on every domain.

Entries

Entries are separated by , with no spaces: example.com,example.org##.ad. A rule with an empty entry, such as example.com,,example.org##.ad or example.com,##.ad, is rejected.

Each entry may be:

  • A domain name. It also matches all subdomains of that domain: example.com matches example.com and ads.example.com.

  • A pattern containing *:

    • example.* matches example.com, example.co.uk, and example.evil.com, but not example-shop.com.
    • *.example.com matches the subdomains of example.com, but not example.com itself.
    • * alone matches every domain.

    A * must not be combined with other characters between dots: in ex*.com, it has no special meaning, and the entry never matches.

Either kind of entry may be prefixed with ~ to negate it.

Entries are matched case-sensitively against the hostname, which is always lowercase, so an entry with uppercase letters never matches. Internationalised domain names must be written in ASCII (Punycode-encoded and prefixed with xn--).

Ports and regular expressions are not supported.

Negated domains

A negated entry ~d acts as a separate exception rule for d: on d and its subdomains, it cancels every rule of the same type with the same body, including the rule it appears in.

For example:

example.com,~shop.example.com##.ad
shop.example.com##.ad

Here, .ad is hidden on example.com and its subdomains, except shop.example.com and its subdomains. The second rule has no effect: the negated entry in the first rule cancels it.

A rule with only negated entries applies nowhere. ~example.com##.ad hides nothing on any domain, and it cancels other ##.ad rules on example.com. To apply a rule on every domain except some, combine * with negated entries: *,~example.com##.ad.

In exception rules, an entry that starts with ~ never matches.