I have the following 2 redirects active:
/code-examples/(.*) -> /tutorials/android/$1/
/code-examples/android/(.*) -> /tutorials/android/$1/
The first one has a higher position, so the second will only be executed if the first one didn't apply. This works if there is something in the placeholders, i.e.
/code-examples/page1 leads to
The problems occur when the placeholders are empty.
/code-examples/android WITHOUT the trailing slash leads to 404. With the trailing slash, I can see that it adds a second slash at the end, which results in
How can I get the redirects to work properly with and without something in the placeholders?
/code-examples(?:/android|)(?:/?(.*)|\b)And the problem with your REGEX is because it's "requiring" the
/(slash) at the end. Btw, this question would have probably been better asked on Stack Overflow.