HTACCESS with PHP value
Hey, I need to filter out requests with certain PHP value in HTACCESS and I cant find how to do th开发者_JAVA技巧at.
The problem is there is someone spamming my site with special PHP value and it keeps my server overloaded.
The URL is www.site.com/?q=XXXXX. I need to filter out all requests like this (with ?q=XXXX) and redirect them to homepage instead.
I tried this but it doesnt work properly (there is a loop).
RewriteCond %{QUERY_STRING} q=(.*)
RewriteRule ^(.*) http://www.site.com
Thanks
why dont u clean out whatever is being put into the _GET value? (using php)
at the top of the php file put something like:
if(isset($_GET['q'])){
header('Location: homepage.php');
}
If someone is spamming you hard enough to overload your server you should look at blocking their IP address/addresses or something along those lines if possible.
Also I would suggest letting those requests die() rather than making them send you another request when they load your homepage. Or maybe keep them busy by redirecting to a domain that doesn't exist or something but that may or may not have an impact on them.
have you thought about counting "X"? if the ?q=X == true, continue, otherwise if q>9 then you know someone is messing with it and restrict them
精彩评论