...

View Full Version : htaccess: Do nothing if particular user agent



codegreen
11-25-2010, 06:43 AM
Hi,

To prevent certain user agents from creating traffic (among other things) I want to setup htaccess to just prevent anything from being sent for the request (rather than sending to an error page)

Right now I have:



RewriteCond %{REQUEST_URI} !^/badagent.php
RewriteCond %{HTTP_USER_AGENT} (.*)BadUserAgent(.*)
RewriteRule .* http://www.domain.com/badagent.php [R=301,L]


What I'd like to do is the following:


RewriteCond %{HTTP_USER_AGENT} (.*)BadUserAgent(.*)
RewriteRule .* [STOP EXECUTION AND DO ABSOLUTELY NOTHING] [L]


How do I do this?

Thanks a ton in advance.

120
11-26-2010, 04:30 PM
As far as I understand it you can't halt it. That would not be a rewrite action, more of a firewall/security mod type option.

Perhaps the H option with an appropriate handler may be of use, but personally rather than **** about like this, I'd send it to a simple page with a pair of opening and closing html tags and be done with it.

I've not looked at this: http://www.modsecurity.org/ but it may do what you want.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum