Answer the question
In order to leave comments, you need to log in
How to block ip if it requests a url with a specific word/value?
I have a website, I see that requests like
mysite.com/ backup
mysite.com/ zip
are made from some ip
mysite.com/ghd/ zip
How can I automatically block ip addresses that make requests with content in the url
backup, zip , etc. .d.
Answer the question
In order to leave comments, you need to log in
In 2 steps:
1. Send all requests through .htaccess to the script router (in PHP) and check the list of banned IPs there before displaying the desired page.
2. When requesting non-existent URLs or with certain words - update the list of IP-bans.
Also, there is a RewriteMap for reading values from a text file for their further use inside .htaccess.
See also the post on using mod_security (+iptables).
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question