Forum Moderators: phranque

Message Too Old, No Replies

How to Block IP Addresses with .htaccess - Including .php URL requests?

         

martinibuster

7:13 am on Aug 10, 2022 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



Never mind the title. I think the problem is that the .htaccess doesn't work for files with php on the end.

I've got an .htaccess file blocking bots and hackers from rogue IP addresses.
Bots coming from blocked IP addys can't access the site. EXCEPT when there's a forward slash and anything.php.

The .htaccess isn't working for ANY URL that ends in PHP.

If the URL is /example/ then the blocking works.

If the URL is /example/index.php then the blocking does NOT work.

Instead of doing a regular .htaccess deny IP, should I just do it like this:

<Files ~ "\.php$"> 
Order Allow,Deny
Deny from 111.111.111.255/24
Deny from 112.111.111.255/24
</Files>



Is there anything that can be done for this?

Thanks!

tangor

7:12 pm on Aug 14, 2022 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Could this be a sign that human brains are still superior to g's AI?
This 31 message thread spans 2 pages: 31