SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Addict
    Join Date
    Mar 2010
    Location
    UK
    Posts
    281
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    IP blocking in htaccess

    Can you help a not-very-technical person, please? I use the following code in an htaccess file in an attempt to block a range of IP addresses. The problem is that it does not work. Example:
    Code:
    Order Allow,Deny
    Allow from all
    Deny from 180.76.*.*
    My searches indicated that this would block any IP address that begins with those digits. So, my questions are:
    Is this code incorrectly formatted?
    If so, what should I use?
    If not, what might be causing this problem?

    If you need more information, I will try to answer as well as I can.

  2. #2
    SitePoint Wizard
    Join Date
    Oct 2005
    Posts
    1,775
    Mentioned
    5 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by adh32 View Post
    Can you help a not-very-technical person, please? I use the following code in an htaccess file in an attempt to block a range of IP addresses. The problem is that it does not work. Example:
    Code:
    Order Allow,Deny
    Allow from all
    Deny from 180.76.*.*
    My searches indicated that this would block any IP address that begins with those digits. So, my questions are:
    Is this code incorrectly formatted?
    If so, what should I use?
    If not, what might be causing this problem?

    If you need more information, I will try to answer as well as I can.
    You do not need the wildcards and that could be the cause of your problem. You block a range of IP addresses like this:

    Code:
    Deny from 180.76
    Deny from 212.7.14
    The first one will block all IP addresses in the 180.76.xxx.xxx range. The second is more restrictive and blocks in the 212.7.14.xxx range. No need for any dots or wildcards after the start of the range.

  3. #3
    SitePoint Addict
    Join Date
    Mar 2010
    Location
    UK
    Posts
    281
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thank you very much.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •