Regex matching

By using regex matching, you can create infinite complex redirect rules.
Available from our Pro plan and up.

How to use

To enable a regex rule, add an exclamation mark (!) before your source URL.


This will tell the redirecting engine that the source's path contains a regex which should be matched against the incoming URL.

Example 1

You have developed a new website, and don't have a news page anymore. You wish to redirect all old news pages to a single URL called ``

You may define a regex rule like:


This will match all pages that start with `news/`, so you can redirect all paths to a single destination.

URLs that would match:

URLs that wouldn't match:

Example 2

You have an old website that have paths that begin with `farming`, `machine` and `agriculture`. You then wish to redirect all paths that begin with `farming` or `machine`. To accomplish this, you can use a regex like stated below.


URLs that would match:

URLs that wouldn't match:

Capture groups

You may define capture groups in your regex to use in the destination. The captured group will be passed along to variables like `$1`, `$2` etc. (up to `$10`).

Example 1:

The following example is a simple capture group. We match all paths after the 'welcome/' path, and pass along that part to the destination via the variable `$1`


Then, you may use the capture group's result with the `$1` variable:$1

Example 2:

The following example matches the URL if it starts with a valid year-month-day format, with a slug next to it. We then want to pass the date & slug to the new destination, but with a slash as a seperator.


URLs that would match:

URLs that wouldn't match:

Then, you may use the two captured groups in the destination how you prefer to build up the new URL:$1-$2

The destination would be build up with the full date and a dash between the slug. Example:

Regex engine

Regexes are matched with the Go/RE2 engine. Reference material can be found here.


We recommend the following tool to match your regex against your path examples: sure you select the Golang flavor)


Do note that the examples above are only indicative examples. Regex matching is extremely powerful and can basically be useful for any path redirect.

More articles

Can’t find the answer you’re looking for?

E-mail us
Start a chat
Online 9:00 - 21:00 CEST
Available with Enterprise
Pricing Background
Domain redirects delivered hassle-free

Get started right away

  • Free plan
  • No creditcard required

you need