4
votes

I have been trying to use optional capturing group in tuckey outbound rule, but it is not working. Any help on this will be highly appreciated.

Can we use the format(.+)? as optional capturing group in tuckey. When I tried in apache it works fine, but in Tuckey it is not working. I even tried escaping the ?, but still doesn't work.

For eg: I have two types of URL

http://xxx/discontinued-products/token/--categories%3C%_c_discontinued_category%7D-- http://xxx/token/--categories%3C%_c_discontinued_category%7D--

I am trying to write an outbound rule to rewrite some words in the URL, but I want the rule to be applicable to both the URL given above, So I used rule starting with following.

In From

^/?(.+)?/token/

In To

$1/token/

1

1 Answers

0
votes

Try from:

^/(.+)?token/(.+)?$

To:

/$1?token/$2

I haven't tested it on real environment, but regex test had showed that it catches both 'from' expressions.