我有很多这样的链接,我想做301
RewriteRule ^best-sales?n=10&p=10$ http://www.bestbuyuniforms.com/best-sales [L,R=301]
RewriteRule ^3_dickies?n=24&id_manufacturer=3$ http://www.bestbuyuniforms.com/3_dickies [L,R=301]
RewriteRule ^imgcmsWilcox%20Culinary%20Arts%20Department.pdf$ http://www.bestbuyuniforms.com [L,R=301]
这些链接
RewriteRule ^157-port-authority-silk-touch-interlock-sport-shirt.html$ http://www.bestbuyuniforms.com/hospitality-housekeeping-polo-shirts/137--port-authority-silk-touch-sport-shirt-with-pocket.html [L,R=301]
RewriteRule ^145-port-authority-extended-size-silk-touch-sport-shirt.html$ http://www.bestbuyuniforms.com/ladies-workwear/151-port-authority-ladies-silk-touch-interlock-sport-shirt.html [L,R=301]
RewriteRule ^217-hanes-stedman-52-ounce-jersey-knit-sport-shirt.html$ http://www.bestbuyuniforms.com/apparel/2329-hanes-comfortblend-ecosmart-jersey-knit-sport-shirt-with-pocket-.html [L,R=301]
RewriteRule ^134-port-authority-long-sleeve-silk-touch-sport-shirt-with-pocket-.html$ http://www.bestbuyuniforms.com/ladies-workwear/132-port-authority-ladies-long-sleeve-silk-touch-sport-shirt-L500LS.html [L,R=301]
如果没有查询字符串使用相同的规则完全重定向,但具有查询字符串或%20%的查询字符串是装箱问题。
答案 0 :(得分:0)
您无法在重写规则中匹配查询字符串,您需要使用%{QUERY_STRING}
和重写cond。
所以:
RewriteCond %{QUERY_STRING} ^n=10&p=10$
RewriteRule ^best-sales$ http://www.bestbuyuniforms.com/best-sales? [L,R=301]
RewriteCond %{QUERY_STRING} ^n=24&id_manufacturer=3$
RewriteRule ^3_dickies$ http://www.bestbuyuniforms.com/3_dickies? [L,R=301]