Htaccess not blocking bots

Discussion in 'Apache' started by ian_ok, Jun 2, 2010.

  1. #1
    I've just noticed that my htaccess file isn't deny BOTS, it just brings up a error 500 page and not the expected 403 page. the deny from Ip address works OK

    Below is an extract of my file:

    <FilesMatch .html>
    SetHandler application/x-httpd-php5
    </FilesMatch>

    <FilesMatch .htm>
    SetHandler application/x-httpd-php5
    </FilesMatch>

    RewriteEngine on
    Options +Indexes
    Options +FollowSymlinks
    RewriteBase /

    redirect 301 /s222s.html http://www.domain.com/
    redirect 301 /pro222s/sitemap.php http://www.domain.com/sitemap.html
    redirect 301 /s222p_1.php http://www.domain.com/sitemap.html

    <Files 403.shtml>
    order allow,deny
    allow from all
    </Files>

    deny from 12.163.148.246
    deny from 24.136.17.129
    deny from 24.164.207.111
    RewriteCond %{HTTP_USER_AGENT} ^Zeus [OR]
    RewriteCond %{HTTP_USER_AGENT} ^ZyBorg [OR]
    RewriteCond %{HTTP_USER_AGENT} ^java [NC,OR]
    RewriteCond %{HTTP_USER_AGENT} ^psycheclone
    RewriteRule ^.* - [F,L]

    Thanks for any help.

    Ian
     
    ian_ok, Jun 2, 2010 IP
  2. trevHCS

    trevHCS Peon

    Messages:
    40
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Not done it that way before, but looks like the syntax is wrong. An example I found said it should be done as:

    Order Allow,Deny
    deny from 12.163.148.246
    deny from 24.136.17.129
    deny from 24.164.207.111
    Allow from all

    RewriteCond %{HTTP_USER_AGENT} ^Zeus [OR]
    RewriteCond %{HTTP_USER_AGENT} ^ZyBorg [OR]
    RewriteCond %{HTTP_USER_AGENT} ^java [NC,OR]
    RewriteCond %{HTTP_USER_AGENT} ^psycheclone
    RewriteRule ^.* - [F,L]

    Trev
     
    trevHCS, Jun 2, 2010 IP
  3. ian_ok

    ian_ok Peon

    Messages:
    551
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Hi trev

    Thanks for that,

    The problem I have is with the rewritecond, the IP ban is fine.

    Hope you and your family are a-ok with the shootings in Cumbria this morning.

    Ian
     
    ian_ok, Jun 2, 2010 IP