Reputation: 199
I am looking for a Regex to redirect urls like:
example.net/example-1
example.net/example-2
example.net/example-3
I have many URLs that have the same prefix, but a different suffix after example-
.
I was trying around with regex.
Redirect 301 /example-.*$ http://example.net/example-overview
Redirect 301 /example-(.*)? http://example.net/example-overview
Redirect 301 /example-(.+)[/]?$ http://example.net/example-overview
Redirect 301 /([^/example-]+) http://example.net/example-overview
I can't get it work.
Normal redirects for example example-1
to example-overview
are working fine.
EDIT: Found a solution:
RedirectMatch 301 ^/example-(.+)[/]?$ http://example.net/example-overview
Upvotes: 1
Views: 208
Reputation: 8181
Redirect doesn't support regular expressions, use RedirectMatch for that.
Upvotes: 2