Sample Header Ad - 728x90

Block access to an URL path by many IPs in .htaccess

0 votes
1 answer
310 views
I am only able to use .htaccess so ` and ` are not possible. I am currently using this to block access by IP:
Require all granted
  Require not ip 1.0.132.75
  Require not ip 1.0.209.198
  Require not ip 1.0.209.229
  # ... many more IPs
I would like to block those many IPs only from accessing a certain path, namely a PHP login accessible at /typo3/ / /typo3/index.php. But blocking everything under /typo3 would be ok, too. I could certainly use this but I hope that there is a shorter, more concise variant:
RewriteCond %{REMOTE_ADDR} "=1.0.132.75"
RewriteRule "^/typo3" "-" [F]
Well, now that I am writing it I found
RewriteCond %{REMOTE_ADDR} "1\.0\.132\.75|1\.0\.132\.76|..."
RewriteRule "^/typo3" "-" [F]
but that Regular Expression would be very long (~3000 IPs). Probably there are better solutions.
Asked by Jonas Eberle (513 rep)
Jun 14, 2022, 10:51 AM
Last activity: Jun 14, 2022, 10:54 AM