As an example.
/code-examples/android/page1
and
/code-examples/page1
should both go to
/tutorials/android/page1
CB
(@cbrandt)
I’d try to create 2 redirects and give them different positions. Since only one redirect is triggered by URL, it should be an order so that the second redirect is only triggered if the first isn’t. For example:
Source: ^/code-examples/android/(.*)
Target: /tutorials/android/$1/
Position: 100
Source: ^/code-examples/(.*)
Target: /tutorials/android/$1/
Position: 101
I hope it works. Good luck!
-
This reply was modified 5 years, 6 months ago by CB.
Oh, I didn’t know I could do that with order! Thank you!
Actually, it only works IF something is behind the last slash, otherwise it doesn’t work. https://codinginflow.com/code-examples/android
redirects me to /code-examples/android/android.
But only WITHOUT the trailing slash. It redirects properly with the trailing slash, but it redirects me to /tutorials/android// (with 2 trailing slashes). Any idea what could be the reason?
/code-examples/ also does only work with a trailing slash.
It seems like it NEEDS something to put into the placeholders. How can I make it support redirects if the placeholders are empty?
-
This reply was modified 5 years, 6 months ago by flizzywp.
-
This reply was modified 5 years, 6 months ago by flizzywp.
-
This reply was modified 5 years, 6 months ago by flizzywp.
-
This reply was modified 5 years, 6 months ago by flizzywp.
-
This reply was modified 5 years, 6 months ago by flizzywp.
-
This reply was modified 5 years, 6 months ago by flizzywp.
-
This reply was modified 5 years, 6 months ago by flizzywp.
-
This reply was modified 5 years, 6 months ago by flizzywp.
-
This reply was modified 5 years, 6 months ago by flizzywp.
-
This reply was modified 5 years, 6 months ago by flizzywp.
If someone is interested, the following combined regex solved my problems:
/code-examples(?:/android|)(?:/?(.*)|\b)