繁体   English   中英

301重定向不适用于特定的URL

[英]301 Redirect not working on particular URL

我有如下设置的重定向规则

Redirect /Products.aspx?Category_ID=15 https://www.trainerbubble.com/free-training-resources/

但是,当转到该地址时,它将自身附加到现有页面/ training-products上并导致

https://www.trainerbubble.com/training-products/?Category_ID=15

我该如何强制原始重定向并使其停止思考/ training-products页面的一部分?

您不能在Redirect指令中匹配查询字符串。 请改用mod_rewrite规则:

RewriteEngine On

RewriteCond %{QUERY_STRING} ^Category_ID=15$ [NC]
RewriteRule ^Products\.aspx$ https://www.trainerbubble.com/free-training-resources/? [L,NC,R=301]

? 目标网址的末尾是剥离以前的查询字符串。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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