网址重定向htaccess的符合特定格式重定向、格式、网址、htaccess

2023-09-02 20:37:53 作者:共你赴荣华

在冰僵尸表明,一些URL结构已经错位 它是一种方法,将所有的网址开头?id参数后的域名重定向到主页。根据产品页面的ID修改

The Bing bot shows that some of the url structure been misaligned is it a way to forward all urls starting with ?id parameter after the domainname to redirect to home page. The id changes according to product page

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

使用是否尝试过

Have tried using

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

但其没有工作,有什么建​​议,以达到同样的!!

but its not working, any suggestions to achieve the same !!

感谢

添加在

嗨 - 你能提出建议多一个就可以了。

Hi - could you advise on one more on it

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后,如何重定向太首页

That is if the pattern matches :- Itemid immediately after index.php, how to redirect it too to home page

推荐答案

替换您的规则:

RewriteEngine on

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