• I’m trying to block my entire country except my own IP address. What would the code look like for this? Here’s what I’m using and it’s not working. I’m locking myself out of my block. Any ideas?

    <Limit GET POST>
    order allow,deny
    # Country: AFGHANISTAN
    # ISO Code: AF

    deny from 103.5.196.0/23
    deny from 103.7.104.0/22
    deny from 103.23.36.0/22
    deny from 103.23.247.0/24
    deny from 103.28.132.0/22
    deny from 103.247.198.0/24
    deny from 111.125.152.0/21
    deny from 111.223.244.0/22
    deny from 117.55.192.0/20
    deny from 117.104.224.0/21
    allow from my IP
    allow from all
    </Limit>

Viewing 3 replies - 1 through 3 (of 3 total)
  • Moderator Jan Dembowski

    (@jdembowski)

    Forum Moderator and Brute Squad

    I’ve not tried it or tested it, but this looks promising.

    http://ipinfodb.com/ip_country_block_htaccess.php

    I believe your order directive is incorrect for this usage.

    With the directives that you’re first using, directives are evaluated; at least one must match, or the request is rejected.
    http://httpd.apache.org/docs/2.2/mod/mod_authz_host.html#deny

    Instead of:

    order allow,deny

    Try:

    order deny,allow

    So:

    <Limit GET POST>
    order deny,allow
    # Country: AFGHANISTAN
    # ISO Code: AF

    deny from 103.5.196.0/23
    deny from 103.7.104.0/22
    deny from 103.23.36.0/22
    deny from 103.23.247.0/24
    deny from 103.28.132.0/22
    deny from 103.247.198.0/24
    deny from 111.125.152.0/21
    deny from 111.223.244.0/22
    deny from 117.55.192.0/20
    deny from 117.104.224.0/21
    # allow from my IP (replace below with your IP)
    allow from 123.456.789.123
    </Limit>

    Thread Starter Krisssy

    (@krisssy)

    Hi guys, thanks for the reply. None of this seemed to work but I accomplished what I needed to do with the plugin WP Ban: http://ww.wp.xz.cn/extend/plugins/wp-ban/

    I hope this helps someone else.

    Thanks,

    Krissy

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘IP blocking in htacess’ is closed to new replies.