Forum Moderators: phranque

Message Too Old, No Replies

block java ua

         

didibreakit

2:42 pm on Aug 26, 2011 (gmt 0)

10+ Year Member



Hello,

I am trying to block ua's with "java" anywhere in the string EXCEPT if it comes from a certain IP.

Can anyone look at what's below and give some insight as to why it's not working.
Is something needed other that the .* for it to block anywhere in the string?
Thanks
I tried a rewritecond too but no joy their either.



SetEnvIfNoCase User-Agent .*java.* bad_bot
SetEnvIfNoCase Remote_Addr 123\.4\.56\. open_door
Order Deny,Allow
Deny from bad_bot
Allow from env=open_door

wilderness

3:29 pm on Aug 26, 2011 (gmt 0)

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



# UA "contains" Java
SetEnvIfNoCase User-Agent java bad_bot

You'll also need to change the line

Deny from bad_bot

to

deny from env=bad_bot

Comprehension and use of anchors is essential in htaccess.

"Begins with", "ends with" and "contains".

Adding syntax which is not either regex or offered in Apache documentation will also prevent your lines from functioning.

didibreakit

8:10 pm on Aug 26, 2011 (gmt 0)

10+ Year Member



Thanks much