Blocking a range of IP addresses

Discussion in 'Site & Server Administration' started by Colbyt, Jan 5, 2009.

  1. #1
    This is for a shared hosting account but I imagine the same thing goes into the .htaccess file.

    I may cool off and only block one IP but right now I want to block a whole damn country. If I know the country rage is 59.88.0.0 to 59.95.255.255.

    How do I block all of those IPs using .htaccess?

    If on further inspection of the logs I determine my problems came from a range of those IPs would the syntax be the same?

    And is there anyway to customize the message the ip#s get?

    I'm thinking something along the lines of F***-u at the moment but a calmer mind will prevail.

    TIa and rep is promised.
     
    Colbyt, Jan 5, 2009 IP
  2. DomainCo.US

    DomainCo.US Well-Known Member

    Messages:
    2,124
    Likes Received:
    18
    Best Answers:
    0
    Trophy Points:
    100
    #2
    DomainCo.US, Jan 5, 2009 IP
    Colbyt likes this.
  3. kailash

    kailash Well-Known Member

    Messages:
    1,248
    Likes Received:
    42
    Best Answers:
    0
    Trophy Points:
    190
    #3
    Just add the following in your .htaccess:

    deny from 59.88/95

    Kailash
     
    kailash, Jan 5, 2009 IP
    Colbyt likes this.
  4. Colbyt

    Colbyt Notable Member

    Messages:
    3,224
    Likes Received:
    185
    Best Answers:
    0
    Trophy Points:
    210
    #4
    Wow! that looks like a real shortcut method. Blocks the entire range in one line?

    Thanks.
     
    Colbyt, Jan 6, 2009 IP