我现有的链接结构是
http://www.domain.com/compare-smart-phone/?compare_products=SP0006++SP0002++&count_products=2&prawns-details_length=10&chk_compare=SP0006&chk_compare=SP0002&btn_compareproducts=Compare
我可以通过传递所有参数来重定向。但是我想只将几个参数传递给新的URL。
我想将其重定向到
http://www.domain.com/smart-phone/?compare_products=SP0006++SP0002++
请帮我写一个重定向规则。
答案 0 :(得分:0)
将其添加到htaccess文件的文档根目录:
RewriteEngine On
RewriteCond %{QUERY_STRING} ^compare_products=([^&]+)
RewriteRule ^compare-smart-phone/?$ /smart-phone/?compare_products=%1 [R=301,L]