G
G
Grizar2019-11-19 15:54:14
htaccess
Grizar, 2019-11-19 15:54:14

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

1 answer(s)
X
xmoonlight, 2019-11-19
@Grizar

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 question

Ask a Question

731 491 924 answers to any question