Regular Expression Path Matching in Smart Links

Smart Links can route traffic of your short URL depending on parameters added to the path part of that URL.

This is possible with Path REGEXP Smart Links. These links use regular expressions to match requested URL path. If none of defined regular expression patterns match request URL, default URL will be used for redirect.

We are using PCRE2 regular expressions.


Example 1

You have short URL: http://short.2.vu/6f

You add some parameter to this short URL like follows:
http://short.2.vu/6f/code1

In your Smart Link you can define following REGEXP pattern: .+
This pattern will match short link parameter that contains at least one symbol of any kind.

Now in your redirect URL you can use placeholders to substitute data from originally requested URL like follows:
https://example.com/catalog/$0.html

After substituion of input data, resulting redirect URL will be as follows:
https://example.com/catalog/code1.html


Example 2

You have short URL: http://short.2.vu/6f

You add some parameter to this short URL like follows:
http://short.2.vu/6f/123-456-899

In your Smart Link you can define following REGEXP pattern:
(\d+)-(\d+)-(\d+)
This patten will match short link parameter that contains 3 groups of digits separated by "-"

Now in your redirect URL you can use placeholders to substitute data from originally requested URL like follows:
https://example.com/inventory/$3/$2.html?code=$1

Placeholders reference input parameters by number. In our example $1 will reference first groups of digits (123), $2 will reference second group of digits (456) etc. $0 always reference whole matched string (123-456-899).

After substituion of input data, resulting redirect URL will be as follows:
https://example.com/inventory/899/456.html?code=123

Notes