简体   繁体   中英

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

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]

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM