Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to disable "?i=1" parameter in 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.

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.

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

like image 595
upper Avatar asked Jul 13 '17 12:07

upper


2 Answers

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.

RewriteEngine On
RewriteCond %{QUERY_STRING} ^(.*)i=[^&]+(.*)$ [NC]
RewriteRule ^(.*)$ /$1?%1%2 [R=301,L]
like image 91
upper Avatar answered Nov 03 '22 23:11

upper


You need to turn the RewriteEngine on first.

RewriteEngine On
RewriteCond %{QUERY_STRING} ^(.*)i=[^&]+(.*)$ [NC]
RewriteRule ^(.*)$ /$1?%1%2 [R=301,L]
like image 1
Mooze Avatar answered Nov 03 '22 22:11

Mooze