Viewing 1 replies (of 1 total)
  • Plugin Author nintechnet

    (@nintechnet)

    Hi

    This is a feature available in the WP+ Edition (premium).

    You can still use the .htninja to allow or block the bots. For instance:
    1. Disable the rule used to block suspicious bots (#531).
    2. Add the list of bots you want to block the .htninja configuration file:

    $bad_bots = array (
       "Bad Bot",
       "Another Bad Bot",
       // Add some more below...
    );
    
    if ( isset( $_SERVER['HTTP_USER_AGENT'] ) ) {
       foreach ( $bad_bots as $bot ) {
          if ( strpos( $_SERVER['HTTP_USER_AGENT'], $bot) !== FALSE ) {
             return 'BLOCK';
          }
       }
    }

    strpos() is case sensitive. If you need case InSeNsItIve, you can use stripos() instead.

Viewing 1 replies (of 1 total)
  • The topic ‘Selectively allowing bots’ is closed to new replies.