htaccess 301 使用查询字符串重定向
htaccess 301 Redirect with querystring
在我的 htaccess 中,我想从所有使用标准详细信息页面的产品进行 301 重定向
https://www.domain.com/standarddetail.asp ?cid=4135
到以下页面:
https://www.domain.com/index.php?route=product/product&product_id=4135
我想对所有 (cid) 查询字符串执行此操作
我使用查询字符串 (cid) 在此 standarddetail.asp 页面上显示了几千种产品,我希望它们使用 product_id= 查询字符串转到新页面。
我希望它们是 301 重定向。
这是怎么做到的?
在文档根目录的 htaccess 文件中,添加:
RewriteEngine On
RewriteCond %{QUERY_STRING} ^cid=([0-9]+)
RewriteRule ^standarddetail\.asp$ index.php?route=product/product&product_id=%1 [L,R=301]
在我的 htaccess 中,我想从所有使用标准详细信息页面的产品进行 301 重定向
https://www.domain.com/standarddetail.asp ?cid=4135
到以下页面: https://www.domain.com/index.php?route=product/product&product_id=4135
我想对所有 (cid) 查询字符串执行此操作
我使用查询字符串 (cid) 在此 standarddetail.asp 页面上显示了几千种产品,我希望它们使用 product_id= 查询字符串转到新页面。
我希望它们是 301 重定向。
这是怎么做到的?
在文档根目录的 htaccess 文件中,添加:
RewriteEngine On
RewriteCond %{QUERY_STRING} ^cid=([0-9]+)
RewriteRule ^standarddetail\.asp$ index.php?route=product/product&product_id=%1 [L,R=301]