I want to redirect to one query string URL to another:




Any thoughts what to add in .htaccess?


You need to use mod_rewrite to check the query string. Try something like the following at the top of your `.htaccess file:

RewriteEngine On
RewriteCond %{QUERY_STRING} ^(filter_grade-level)=154$
RewriteRule ^product-category/search/$ /$0?%1=k [R=301,L]

In the RewriteRule substitution (ie. /$0?%1=k), $0 is a backreference to the entire matched RewriteRule pattern and %1 is a backreference to the captured group in the last matched CondPattern (ie. "filter_grade-level").

So, on success, /$0?%1=k expands to:


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.