How to block ip ranges in htaccess.

Discussion in 'Apache' started by m0rtal, Jul 12, 2007.

  1. #1
    m0rtal, Jul 12, 2007 IP
  2. Kezi

    Kezi Active Member

    Messages:
    68
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    91
    #2
    Yep, that's an excellent tool, but has anyone come across a few lines of code that would exclude everyone from all countries viewing the website, except for people from the UK, Ireland and Spain ?

    Any help much appreciated.

    Kezi.
     
    Kezi, Jul 13, 2007 IP
  3. woods

    woods Peon

    Messages:
    228
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Try simply doing it the other way?

    deny from all

    and then allow the countries (using blockacountry.com) instead of denying.

    Note: I don't know how much of each country that blockacountry lists.. So the problem when denying everybody and just allowing the ones from UK+ireland+Spain is that it might actually miss people and deny them if they're not in the list.

    That's a question of how well it lists.

    So I would rather deny all the countries except UK+Ireland+Spain to be on the safe side
     
    woods, Jul 13, 2007 IP
  4. Kezi

    Kezi Active Member

    Messages:
    68
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    91
    #4
    Many thanks Woods - the info is appreciated.

    That seems like a good idea and less code to do it way - the only problem, is that just with those 3 countries, you're looking at least a few hundred lines of code ;-( Which can drag the page speed down quite a bit ;-(

    Has anyone looked at the option on the page below, using php ?

    http://tinyurl.com/23fpjq

    Any help much appreciated.
     
    Kezi, Jul 13, 2007 IP