0

Currently i'm getting a DDoS attack directly to this URL: myserver.com/?task=randompost, the "?task=randompost" doesnt exist anymore so they get redirected to the home webpage. Considering that they are attacking directly to that url path, its there any way to block all users that tries to enter that path??

Thanks!

PingP0n6
  • 11
  • 4

1 Answers1

0

This can be done with mod_rewrite:

RewriteEngine On
RewriteBase /

RewriteCond %{QUERY_STRING} =task=randompost
RewriteRule ^$ - [F,L]

This will ONLY work for example.com/?task=randompost request (will not work for example.com/index.php?task=randompost) and it needs to be placed in .htaccess somewhere at the top (before any other rewrite rules). If placed in virtual host context, the ^$ needs to be replaced by ^/$.

The [F] flag will instruct Apache to return 403 error immediately.

LazyOne
  • 3,014
  • 1
  • 16
  • 15