Reputation: 23
http://www.domain.com/old-name-here?manufacturer=445 should display as:
http://www.domain.com/new-name-here/brand-name
If I enter the following htaccess code:
Redirect 301 /old-name-here?manufacturer=445 /new-name-here/brand-name-here
It does redirect properly via 301, but it keeps the query string on the end and only redirects the 1st folder...
Upvotes: 2
Views: 159
Reputation: 785206
Redirect
directive cannot match QUERY_STRING. You should use mod_rewrite
rules.
You can use this rule in your DOCUMENT_ROOT/.htaccess
file:
RewriteEngine On
RewriteCond %{QUERY_STRING} (^|&)manufacturer=45(&|$) [NC]
RewriteRule ^old-name-here/?$ /new-name-here/brand-name-here? [NC,L,R=301]
?
in the end will strip any existing query string from target URI.
Upvotes: 0