Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Dec 2006
    Posts
    18
    Thanks
    2
    Thanked 0 Times in 0 Posts

    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.

  • #2
    120
    120 is offline
    Regular Coder
    Join Date
    Nov 2009
    Location
    UK
    Posts
    105
    Thanks
    6
    Thanked 15 Times in 15 Posts
    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


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •