How do you ban an ip address?

Discussion in 'Web Design and Development' started by Chef55, Oct 27, 2008.

  1. Chef55 macrumors member

    Joined:
    Sep 10, 2008
    Location:
    U.K.
    #1
    Am having trouble with someone leaving messages on my guestbook so want to ban their ip address so they can't access my site. I don't use an iMac account. Help please anyone?
     
  2. belvdr macrumors 601

    Joined:
    Aug 15, 2005
    #2
    Can you explain your config some more? Is this an app hosted on your system at home? Do you have a firewall?

    That said, if this person has a dynamic IP, this will likely only deter them for a period of time.
     
  3. angelwatt Moderator emeritus

    angelwatt

    Joined:
    Aug 16, 2005
    Location:
    USA
    #3
    If you're using an Apache web server, add this to a .htaccess file:
    Code:
    <Limit GET POST>
       order allow,deny
       allow from all
       deny from 100.100.100.100
    </Limit>
    That .htaccess file should be saved to your htdocs (or equivalent folder i.e. htmlpublic) folder.

    Like belvdr mentioned though, people generally have a dynamic IP so it's not a full-proof solution. You can also use PHP/MySQL to keep a list of IP to block. There should be scripts out there for setting this up. You might be able to set other solutions up too depending how consistent this user is.
     

Share This Page