.htaccess htaccess重定向与特定格式匹配的url

.htaccess htaccess重定向与特定格式匹配的url,.htaccess,url-redirection,.htaccess,Url Redirection,Bing机器人显示一些url结构没有对齐 这是一种将域名后以?id参数开头的所有URL转发到主页的方法。id根据产品页面的不同而变化 http://www.abc.com/?id=100&itemid=2&option=com_toys&view=post - Incorrect url http://www.abc.com/index.php?option=com_toys&view=post&id=100&Itemid=2 - correct

Bing机器人显示一些url结构没有对齐 这是一种将域名后以?id参数开头的所有URL转发到主页的方法。id根据产品页面的不同而变化

http://www.abc.com/?id=100&itemid=2&option=com_toys&view=post - Incorrect url
http://www.abc.com/index.php?option=com_toys&view=post&id=100&Itemid=2 - correct url
试过使用

RewriteCond %{REQUEST_URI} ^.*/?id.*$
RewriteRule .*  index.php     [R=301,L]
但是它不起作用,任何建议都可以达到同样的效果

谢谢

附加组件

嗨,你能再给我一个建议吗

http://www.abc.com/index.php?Itemid=2&id=100&option=com_toys&view=post - Incorrect url
http://www.abc.com/index.php?option=com_toys&view=post&id=100&Itemid=2 - correct url

如果模式匹配:-Itemid紧跟index.php之后,如何将其重定向到主页

将规则替换为:

RewriteEngine on

RewriteCond %{QUERY_STRING} ^id=.*
RewriteRule ^$  /?     [R=301,L]

嗨-不起作用,它会导致这个url-是的,我想这就是你想要的,你想将它重定向到没有查询字符串的主页(没有id=…)?我已经更新了我的答案,所以它确实重定向到没有查询字符串的主页(确保清除浏览器缓存)嗨,附加了一个类似模式的查询,你能看看我能不能给你一些建议吗