Skip to content

Commit

Permalink
Merge pull request #542 from ngorskikh/feature/AG-11513
Browse files Browse the repository at this point in the history
Update the description of `$urltransform` rules
  • Loading branch information
ngorskikh authored Aug 20, 2024
2 parents 9123bf4 + a2eb85c commit 6884eac
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions docs/general/ad-filtering/create-own-filters.md
Original file line number Diff line number Diff line change
Expand Up @@ -2428,12 +2428,11 @@ Rules with `$replace` modifier are supported by AdGuard for Windows, Mac, and An

#### **`urltransform`** {#urltransform-modifier}

The `$urltransform` rules allow you to modify the request URL by replacing the text matched by the regular expression.
The `$urltransform` rules allow you to modify the request URL by replacing text matched by a regular expression.

**Features**

- `$urltransform` rules apply to any request URL text.
- `$urltransform` rules can also **modify the query part** of the URL.
- `$urltransform` rules normally only apply to the path and query parts of the URL, see below for one exception.
- `$urltransform` will not be applied if the original URL is blocked by other rules.
- `$urltransform` will be applied before `$removeparam` rules.

Expand All @@ -2457,6 +2456,18 @@ urltransform = "/" regexp "/" replacement "/" modifiers

In the `$urltransform` value, two characters must be escaped: the comma `,` and the dollar sign `$`. Use the backslash character `\` for this. For example, an escaped comma looks like this: `\,`.

**Changing the origin**

:::info Compatibility

This section only applies to AdGuard for Windows, AdGuard for Mac, and AdGuard for Android with [CoreLibs] v1.17 or later.

:::

As stated above, normally `$urltransform` rules are only allowed to change the path and query parts of the URL.
However, if the rule's `regexp` begins with the string `^http`, then the full URL is searched and can be modified by the rule.
Such a rule will not be applied if the URL transformation can not be achieved via an HTTP redirect (for example, if the request's method is `POST`).

**Examples**

```adblock
Expand Down

0 comments on commit 6884eac

Please sign in to comment.