Forum Moderators: phranque

Message Too Old, No Replies

Blocking a UA?

         

keyplyr

9:21 am on Jun 5, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month




Curious to why this wasn't blocked:

220.211.31.** - - [05/Jun/2004:01:48:33 -0700] "GET / HTTP/1.0" 200 10588 "http://www.domain.com" "Java(TM) 2 Runtime Environment, Standard Edition"

by this rule:

RewriteCond %{HTTP_USER_AGENT} (Python.urllibŠJava/?[1-9]\.[0-9]) [NC]
RewriteRule!^robots\.txt$ - [F]

Robert Thivierge

10:33 am on Jun 5, 2004 (gmt 0)

10+ Year Member



"Java/" does not match "Java(TM)" because there is not a "/" in the latter. Try using "\b", which matches word boundries, like:

RewriteCond %{HTTP_USER_AGENT} \b(JavaŠPython\.urllib)\b [NC]

If "Java" always occurs at start of string

RewriteCond %{HTTP_USER_AGENT} ^(JavaŠPython\.urllib)\b [NC]

keyplyr

5:20 pm on Jun 5, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Thanks Robert,

However the \b did not work. It still allowed that UA.

This works:

RewriteCond %{HTTP_USER_AGENT} ^(JavaŠPython\.urllib) [NC]

which was always a consideration, I just wanted to maintain a tighter control.