简体   繁体   English

301 redirect .HTACCESS-删除查询字符串

[英]301 redirect .HTACCESS - Remove Query String

I have a 404 page being found by analytics. 我有一个被分析发现的404页面。 I'm having trouble figuring out the correct syntax for redirecting the link below via .htaccess. 我在找出通过.htaccess重定向下面的链接的正确语法时遇到麻烦。 Can anyone offer a solution? 谁能提供解决方案? Thank you very much. 非常感谢你。

http://www.mywebsite.com/product-categories?format=feed&type=atom

I tried this and plenty of others without success. 我尝试了这个,还有很多其他人都没有成功。

RewriteCond %{QUERY_STRING} ^format=feed&type=atom$
RewriteRule ^product-categories/$ http://www.mywebsite.com/product-categories/?  [L,R=301]

You have condition reverse in your RewriteRule . 您的RewriteRule存在条件反转。 Use this rule: 使用以下规则:

RewriteCond %{QUERY_STRING} ^format=feed&type=atom$ [NC]
RewriteRule ^product-categories/?$ /product-categories/? [NC,NE,L,R=301]

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

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