I have some urls looking like this:
redirect 301 /some/old/url/ http://example.com/url
redirect 301 /some/old/test/ http://example.com/test
What I do want is kind of like this:
redirect 301 /some/old/[word-match-with-or-without-trailing-slash] http://example.com/[same-word-without-trailing slash]
How do I do this? The problems:
- Match both with or without slash.
- Keep the match without slash for later use (see next).
- Put the match witout slash at the end of the line.
Update
It seems like I could do something like this (untested):
redirect 301 /some/old/(.*) http://example.com/$1
But then how can I remove the possible trailing slash in $1
?