Go Back   CodingForums.com > :: Server side development > Apache configuration

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 11-25-2010, 06:43 AM   PM User | #1
codegreen
New Coder

 
Join Date: Dec 2006
Posts: 18
Thanks: 2
Thanked 0 Times in 0 Posts
codegreen is an unknown quantity at this point
Post htaccess: Do nothing if particular user agent

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:

Code:
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:
Code:
RewriteCond %{HTTP_USER_AGENT} (.*)BadUserAgent(.*)
RewriteRule .* [STOP EXECUTION AND DO ABSOLUTELY NOTHING] [L]
How do I do this?

Thanks a ton in advance.
codegreen is offline   Reply With Quote
Old 11-26-2010, 04:30 PM   PM User | #2
120
Regular Coder

 
Join Date: Nov 2009
Location: UK
Posts: 105
Thanks: 6
Thanked 15 Times in 15 Posts
120 has a little shameless behaviour in the past
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.
__________________
There is always plenty of idol work for the devils hands to do
Registered Linux User 475075 : Project Honeypot
120 is offline   Reply With Quote
Reply

Bookmarks

Tags
htaccess, prevent execution

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 07:32 AM.


Advertisement
Log in to turn off these ads.