.htaccess Question?

Discussion in 'Programming' started by richybear, Mar 9, 2009.

  1. #1
    First let me say I'm not a coder, a novice really.

    I have a qustion regarding the .htaccess file:

    I have several functions I am using it for, Here's what it looks like now minus several entries to shorten it for the post:

    Options +FollowSymLinks
    RewriteEngine on
    
    # BOTS BLOCKED
    RewriteCond %{HTTP_REFERER} ^http(s)?://(www\.)?http://mysite.com.*$ [NC]
    [COLOR="Red"]RewriteRule .* - [F,L][/COLOR]
    
    # BAD SPIDERS 
    RewriteCond %{HTTP_USER_AGENT} ^BlackWidow [OR] 
    RewriteCond %{HTTP_USER_AGENT} ^Bot\ mailto:craftbot@yahoo.com [OR] 
    RewriteCond %{HTTP_USER_AGENT} ^ChinaClaw [OR] 
    RewriteCond %{HTTP_USER_AGENT} ^Custo [OR] 
    RewriteCond %{HTTP_USER_AGENT} ^DISCo [OR] 
    RewriteCond %{HTTP_USER_AGENT} ^Zeus 
    [COLOR="Red"]RewriteRule ^.* - [F,L][/COLOR]
    
    # CHINA
    <Limit GET HEAD POST>
    order allow,deny
    deny from 58.14.0.0/15
    deny from 58.16.0.0/16
    deny from 58.17.0.0/17
    deny from 58.17.128.0/17
    allow from all
    </LIMIT>
    Code (markup):
    My question is should I have this line after every Rewrite Rule?:

    RewriteRule ^.* - [F,L]
     
    richybear, Mar 9, 2009 IP
  2. kmap

    kmap Well-Known Member

    Messages:
    2,215
    Likes Received:
    29
    Best Answers:
    2
    Trophy Points:
    135
    #2
    yes that is correct

    it makes everything forbidden and throws a 403 server response

    Regards

    Alex
     
    kmap, Mar 9, 2009 IP
  3. richybear

    richybear Peon

    Messages:
    51
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thanks Alex, I appreciate, you responding.

    Another simple question, I just want to make sure what I put here is actually working.

    I used "#" for Just read lines. Is this correct, or should I be using "/" or something else?

    Thanks.
     
    richybear, Mar 9, 2009 IP
  4. DanPonjican

    DanPonjican Active Member

    Messages:
    268
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    80
  5. kmap

    kmap Well-Known Member

    Messages:
    2,215
    Likes Received:
    29
    Best Answers:
    2
    Trophy Points:
    135
    #5
    yes for comments and lines to be ignored start by #

    Regards

    Alex
     
    kmap, Mar 9, 2009 IP