bones
bones

Reputation: 848

redirect url with query string to another url

I am trying to redirect the following URL

http://www.mydomain.com/catalogsearch/result/index/?brand=1076&mode=grid&product_category=5533&q=pro+restore    

To this URL:

http://www.mydomain.com/nsearch/?q=pro+restore

This is the code I've used for other urls in htaccess:

RewriteCond %{REQUEST_URI} ^/catalogsearch/result/index/$
RewriteCond %{QUERY_STRING} ^brand=1076&mode=grid&product_category=5533&q=pro+restore$
RewriteRule ^(.*)$ http://www.mydomain.com/nsearch/?q=pro+restore [R=301,L]

But it doesn't work. Any ideas on what I am missing?

Thanks

Upvotes: 1

Views: 158

Answers (1)

anubhava
anubhava

Reputation: 784958

Try this code in your DOCUMENT_ROOT/.htaccess file:

RewriteEngine On

RewriteCond %{QUERY_STRING} ^brand=1076&mode=grid&product_category=5533&(q=pro\+restore)$ [NC]
RewriteRule ^catalogsearch/result/index/?$ /nsearch/?%1 [R=301,L]

Upvotes: 1

Related Questions