How to block people from specific country from accessing my site?

Discussion in 'Site & Server Administration' started by Sxperm, Apr 11, 2008.

  1. #1
    I want to block people from specific country/ip from accessing my website. How can I do that?
     
    Sxperm, Apr 11, 2008 IP
  2. jingjong

    jingjong Peon

    Messages:
    173
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #2
    jingjong, Apr 11, 2008 IP
    Sxperm likes this.
  3. Sxperm

    Sxperm Notable Member

    Messages:
    4,386
    Likes Received:
    142
    Best Answers:
    0
    Trophy Points:
    225
    #3
    Thanks. Green rep added :)
     
    Sxperm, Apr 11, 2008 IP
  4. LittleJonSupportSite

    LittleJonSupportSite Peon

    Messages:
    386
    Likes Received:
    20
    Best Answers:
    0
    Trophy Points:
    0
    #4
    While that method does work I would actually go another route and use a geo target on the client itself.

    Checking both the browser language and client IP.

    People can still use proxies using the method above, where has going the next step and verifying languages and countries will make it that much more difficult to do.
     
    LittleJonSupportSite, Apr 11, 2008 IP
  5. Dollar

    Dollar Active Member

    Messages:
    2,598
    Likes Received:
    82
    Best Answers:
    0
    Trophy Points:
    90
    #5
    This works but can bog your server if you alot CIDR lines in it. Plus also the will see,

    FORBIDDEN

    If you want make it like you don't exist, not even respond to any pings use iptables if you have a root access.
    You can read how to do this here, block with Iptables
     
    Dollar, Apr 11, 2008 IP
  6. osdude

    osdude Peon

    Messages:
    76
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #6
    OK, this is what I use. It's loads faster and less boggy than using a long lists of IPs to load for every page.


    .htaccess
    <Limit GET POST>
    order allow,deny
    allow from all
    deny from ip address
    deny from .cn
    deny from .id
    deny from .ng
    deny from .zw
    deny from .gh
    </Limit>
    <Limit PUT DELETE>
    order deny,allow
    deny from all
    </Limit>
    PHP:
    If the referring IP resolves to any of the above country extension, the user is blocked: 403 Forbidden
    granted, it can be bypassed and it's not fool-proof, but it does do a reasonable job for what resources it uses
     
    osdude, Apr 21, 2008 IP