Reputation: 23
I searched the web an could not find an answer for this htaccess issue.
I have a broken site with many product URLs like:
de/biegsames-uhrenmannchen-flexi-4102193
de/biegsames-uhrenmannchen-flexi-4102200
de/biegsames-uhrenmannchen-flexi-4102200
de/biegsames-uhrenmannchen-flexi-4102207
I'd like to redirect all URLs to
de/biegsames-uhrenmannchen-flexi
I tried:
RewriteRule ^de/biegsames-uhrenmannchen-flexi* /de/biegsames-uhrenmannchen-flexi
but with no change. How can I redirect multiple URLs regarding just the first words and ignore everything behind the *?
like: url-bla-bla-bla* --> goes to url-bla-bla
So
url-bla-bla-bla-ui-ui-ui url-bla-bla-bla-oh-oh
--> would be redirected to url-bla-bla.
Every help is appreciated and I am so thankful, since I have to fix thousands of broken URLs.
Upvotes: 2
Views: 265
Reputation: 691
U could try:
RewriteRule ^de/biegsames-uhrenmannchen-flexi(.*)$ /de/biegsames-uhrenmannchen-flexi [R=301,L]
(.*)$ = everything that comes after de/biegsames-uhrenmannchen-flexi.
[R=301,L] = permanent redirect and the L means to stop applying any rules that follow.
Upvotes: 1