WordPress.org

Ready to get started?Download WordPress

Forums

How to ban IPS? (9 posts)

  1. XeroCool
    Member
    Posted 9 years ago #

    Does anybody know how I can ban a IP in WP? .htaccess or what?

  2. XeroCool
    Member
    Posted 9 years ago #

    And btw, how do I ban refers (ex: I dont want reffers coming from spamsite.com, and I want them to be redirected or say a message).

  3. xmiinc
    Member
    Posted 9 years ago #

  4. error
    Member
    Posted 9 years ago #

    .htaccess

    <Limit GET POST PUT>
    Order allow,deny
    Allow from all
    Deny from 10.11.12.13
    Deny from 172.16.135.0/24
    Deny from 192.168.0.0/16
    </Limit>

  5. davidchait
    Member
    Posted 9 years ago #

    CG-Referrer can do both.

    -d

  6. Em158
    Member
    Posted 9 years ago #

    I've been customizing the hell out of my WP and part of my upgrading from NewsPRO/ASP to WP was importing my ASP IP banning script.
    Currently, this is the script I am using and it works perfectly:

    <?php
    $banned_ip = array();
    $banned_ip[] = '123.123.123.123'; //specific
    $banned_ip[] = '222.222.222; //beginning with those 3 sets
    $banned_ip[] = '222.222'; //222.222.1.1, 222.222.242.142, etc.
    $banned_ip[] = '25'; //let's block anything beginning with 25

    foreach($banned_ip as $banned) {
    $ip = $_SERVER['REMOTE_ADDR'];
    if(0 === strpos($ip, $banned)) {
    header("Location: "."[URL TO SEND PEOPLE TO]");
    exit();
    }
    }
    ?>

    you can add as many IPs as you want, etc...

  7. waynertrain
    Member
    Posted 8 years ago #

    Sorry guys, but I am new to WP and blogging and need a little more specific help with this. Now that I have the code to ban certain IP addresses thanks to previous posts, I need to know where to add the code in. Do I just put it in the CSS template or is there a better place? I really appreciate any help you can give me. Thanks in advance.

  8. Mark (podz)
    Support Maven
    Posted 8 years ago #

    The details need to go in a .htaccess file from where you need to block.
    This is a good guide for starters:
    http://www.clockwatchers.com/htaccess_intro.html

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.