Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

This question already has an answer here:

Currently i'm getting a DDoS attack directly to this URL:, 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??


share|improve this question

marked as duplicate by Tom O'Connor Aug 25 '13 at 21:41

This question was marked as an exact duplicate of an existing question.

This can be done with mod_rewrite:

RewriteEngine On
RewriteBase /

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

This will ONLY work for request (will not work for 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.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.