Reputation: 1
I've searched answers on the forum but didn't worked for me.
I have rebuild an website using Wordpress and want to keep old urls.
old url:
/bingo/play-bingo-40/review?reviews_id=16
nwe url:
https://website.com/product/the-new-url-of-play-bingo-40/
I have tried this:
RewriteCond %{QUERY_STRING} ^reviews_id=([^&]+) [NC]
RewriteRule ^bingo/play-bingo-40/review https://website.com/product/the-new-url-of-play-bingo-40/? [R=301]
Any one?
Upvotes: 0
Views: 438
Reputation: 74078
You don't use anything from the query string, so you don't need to capture with a RewriteCond
. You seem to use part of the request URL, so you must capture this one
RewriteRule ^bingo/(.+?)/review https://example.com/product/the-new-url-of-$1/? [R,L]
To learn more about mod_rewrite generally and regular expressions particularly, see http://httpd.apache.org/docs/current/rewrite/intro.html. Another good reference for regular expressions is http://www.regular-expressions.info/
Upvotes: 0