Reputation: 186
Please help to fix these redirects:
Redirect 1. category/?option=value => domain.com/category/page.html
RewriteCond %{QUERY_STRING} ^option=value(&.*)?$ [NC]
RewriteRule ^category/$ http://domain.com/category/page.html%1 [R=301,NE,NC,L]
Redirect 2. category/sub-%26-category/?option=value => domain.com/category/page1.html
RewriteCond %{QUERY_STRING} ^option=value(&.*)?$ [NC]
RewriteRule ^category/sub-\x26-category/$ http://domain.com/category/page1.html%1 [R=301,NE,NC,L]
Upvotes: 1
Views: 34
Reputation: 785128
You need to use ?
in target URI to strip off any existing query string:
RewriteCond %{QUERY_STRING} ^option=value(&.*)?$ [NC]
RewriteRule ^category/$ /category/page.html? [R=301,NE,NC,L]
RewriteCond %{QUERY_STRING} ^option=value(&.*)?$ [NC]
RewriteRule ^category/sub-\x26-category/$ /category/page1.html? [R=301,NE,NC,L]
Make sure these rules are placed above other internal routing rules.
Upvotes: 1