我需要重定向网址,例如:
www.mydomain.com/category/sub-category/product?page=shop.ask&flypage=flypage.tpl&product_id=181&category_id=34
要:
www.mydomain.com/category/sub-category/good-product.html
我有多个带参数的网址,需要重定向到一个或几个网址,你能帮助我吗,我用谷了几个小时。
我在.htaccess
尝试此代码:
redirect 301 /category/sub-category/product?page=shop.ask&flypage=flypage.tpl&product_id=181&category_id=34 www.mydomain.com/category/sub-category/good-product.html
但它不起作用。
答案 0 :(得分:0)
您无法与Redirect
指令中的查询字符串进行匹配。你需要使用mod_rewrite:
RewriteEngine On
RewriteCond %{QUERY_STRING} ^page=shop.ask&flypage=flypage.tpl&product_id=181&category_id=34$
RewriteRule ^category/sub-category/product$ /category/sub-category/good-product.html? [L,R=301]