skip to Main Content

I see some traffic burst on my apache with all invalid URLs but with a specific pattern. Below are the some URLs

www.example.com/?1gx2A1WV=Ji7iMHhDsDOHvesb8

www.example.com/?LTn28PGXpg=VQTNObTmrhyF7Pjs2VoX

So basically I want to block this pattern in apache. anything that has “?” after www.example.com/ should be blocked.

Can someone please help me creating RewriteRule in apache for this.
Thanks in advance.

2

Answers


  1. This should help. RewriteCond matches the pattern you have mentioned for request uri. Rewrite Rule sends back 403 as HTTP Response. Your use of Location may vary based on your apache configuration.

    <Location />
    RewriteEngine On
    RewriteCond %{REQUEST_URI} ^/?.*$ 
    RewriteRule ^.*$ - [F,L]
    </Location>
    
    Login or Signup to reply.
  2. REQUEST_URI does not contain query string.
    Try matching your rule against QUERY_STRING

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search