You’ll need to be more specific with your regex so it only matches the exact URL you want to redirect. Also, you can use ^ and $ to match only the start and end of a URL.
Thank for the reply.. that’s the thing, i don’t know how to be more specific. Can you help in an example like /wordpress-is-awesome/wordpress-is-awesome/wordpress-is-awesome/wordpress-is-awesome/ ?
I’ll play with ^ and $ and see what happens.
Something like this would not match any other URLs:
^/wordpress-is-awesome/.*
If you only have the one URL to match then there is no need to use a regex – just match the entire URL.
It’s different URLs all the time following the same pattern… so it’s ^/.*/.* or not? 🙂
Then it looks like unless you can find a way to uniquely describe the URLs there is no single pattern that will fit. A regex is powerful but it won’t fit all situations.
Titanas,
There is actually a way to do exactly what you want with regular expressions, though by the looks of the above thread, it is a lesser known feature:
Source URL: ^(/[a-z0-9-]+){\1}+[/]?$
Target URL: $1
Explanation:
() the regex remembers what is between brackets. With \1 you have the regex recall the remembered string and match that again one or more times – in this case ‘/wordpress-is-awesome’ -. I put the \1 between {} to avoid the regex confusing it with a literal pattern.
In the target use $1 as the starting / is already included in the match.
Hope this helps!
Smile,
Juliette