Search code examples
.htaccessipblock

Block Range of IPs


I'm trying to block a range of IPs from visiting my website

Here is what I have in my .htaccess file

order allow,deny
Deny from 64.244.0.0/64.245.255.255
Deny from 64.244.0.0/15
allow from all

I'd like to know if anyone can tell (or estimate) me how many IPs have i blocked there?


Solution

  • I believe the first DENY FROM is just wrong. I've always seen it this way

        64.244.0.0/15
    Base Address^  ^Number of bits to use for subnet
    

    This would mean that you have 2^15 addresses in the deny block.

    Edit

    Using the comments below, what you would want is

    ORDER deny,allow
    DENY from 64.244.0.0/15
    ALLOW from all