[英]301 Redirect not working on particular URL
I have a redirect rule set up as below 我有如下设置的重定向规则
Redirect /Products.aspx?Category_ID=15 https://www.trainerbubble.com/free-training-resources/
However, when going to the address it attaches itself to an existing page /training-products and results in this 但是,当转到该地址时,它将自身附加到现有页面/ training-products上并导致
https://www.trainerbubble.com/training-products/?Category_ID=15
How can I force the original redirect and make it stop thinking its part of the /training-products page? 我该如何强制原始重定向并使其停止思考/ training-products页面的一部分?
You cannot match query string in Redirect
directive. 您不能在
Redirect
指令中匹配查询字符串。 Use mod_rewrite
rules instead: 请改用
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]
?
at the end of target URL is to strip off previous query string. 目标网址的末尾是剥离以前的查询字符串。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.