Search code examples
apache.htaccessmod-rewriteip

How to lock unwanted IPs in the .htaccess?


In most cases, the .htacess seems to lock out unwanted visitors from my site. But some bad boys are able to penetrate my .htacess protection. Example: The bad boy is has the IP 46.161.11.xx . So I wrote into the .htaccess file:

Require not ip 46.161.11.

But this did not help. So I changed it to:

RewriteCond %{REMOTE_ADDR} ^46\.161\.11\.([1-9]?\d|[12]\d\d)$ [NC]
RewriteRule ^.* - [F,L]

But this does not help, too.

Is there a more effective IP lock in Apache? Thx in advance for your hints.


Solution

  • This seems to be my solution:

        RewriteCond %{REMOTE_HOST} 46\.161\.11\.
        RewriteRule .* - [F,L]