如何禁用“?i=1"网址中的参数 [英] How to disable "?i=1" parameter in URL

查看:28
本文介绍了如何禁用“?i=1"网址中的参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的网站在 InfinityFree 托管上运行,它广告 ?i=1 后缀(如 www.mysite.com/?i=1/?i=2/?i=3) 到每个 URL 以保护网站免受恶意机器人的攻击,正如他们所说.

My website is running on InfinityFree hosting and it ads ?i=1 suffixes (like www.mysite.com/?i=1, or /?i=2, or /?i=3) to every URL to protect websites against malicious bots, as they say.

当然,我不喜欢这些后缀并想禁用它们(只需将 www.mysite.com/anypage/?i=1 重定向到 www.mysite.com/anypage/).请注意,我不想禁用所有 GET 参数,而只想禁用这些 i=1i=2i=3.

But of course, I don't like these suffixes and want to disable them (simply redirecting www.mysite.com/anypage/?i=1 to www.mysite.com/anypage/). Note that I don't want to disable all GET parameters, but only these i=1, i=2 and i=3.

我认为可以使用 .htaccess 来完成.有人可以帮我吗?

I think it could be done using .htaccess. Can someone help me, please?

推荐答案

好吧,我已经使用 这个问题.我刚刚在我的 .htaccess 中添加了这段代码,现在它将所有带有i"的 URL 重定向到没有它的 URL.

Well, I've solved the problem using a code from this question. I've just added this code in my .htaccess, and now it redirects all the URLs with "i" to the URLs without it.

RewriteCond %{QUERY_STRING} ^(.*)i=[^&]+(.*)$ [NC]
RewriteRule ^(.*)$ /$1?%1%2 [R=301,L]

这篇关于如何禁用“?i=1"网址中的参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆