Return-Path: Delivered-To: apmail-httpd-users-archive@www.apache.org Received: (qmail 36486 invoked from network); 11 Dec 2003 05:55:45 -0000 Received: from daedalus.apache.org (HELO mail.apache.org) (208.185.179.12) by minotaur-2.apache.org with SMTP; 11 Dec 2003 05:55:45 -0000 Received: (qmail 42114 invoked by uid 500); 11 Dec 2003 05:55:13 -0000 Delivered-To: apmail-httpd-users-archive@httpd.apache.org Received: (qmail 41918 invoked by uid 500); 11 Dec 2003 05:55:11 -0000 Mailing-List: contact users-help@httpd.apache.org; run by ezmlm Precedence: bulk Reply-To: users@httpd.apache.org list-help: list-unsubscribe: list-post: Delivered-To: mailing list users@httpd.apache.org Received: (qmail 41904 invoked from network); 11 Dec 2003 05:55:11 -0000 Received: from unknown (HELO mail.profundis.se) (213.80.46.101) by daedalus.apache.org with SMTP; 11 Dec 2003 05:55:11 -0000 X-ITHouse-Forward-Path: Received: From PROFUNDIS01 by mail.profundis.se (IT House Mail Server [TRIAL - 120 days left]); Thu, 11 Dec 2003 06:55:10 +0100 Message-ID: <069c01c3bfab$567ab120$652e50d5@profundis.se> Reply-To: "Robert Andersson" From: "Robert Andersson" To: References: <3FD7AACD.522FAA91@shawcable.com> Date: Thu, 11 Dec 2003 06:55:10 +0100 Organization: Profundis MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1158 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N Subject: Re: [users@httpd] New post, Mod rewrite X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N Selmer Ausland wrote: > I would like to use Mod Rewrite to ban bad bots from my root directory. > Below is an example of what I have in mind. > > RewriteEngine On > RewriteCond %{HTTP_USER_AGENT} ^ChinaClaw [OR,NC] > RewriteCond %{HTTP_USER_AGENT} ^Bot\mailto:craftbot@yahoo.com [OR,NC] > RewriteRule /*$ http://www.mydomain.com [L,R] I think that rule could use some modification; the pattern doesn't make much sense. You probably just want ".*". Are you sure you want to redirect them back to what I assume is your front, rather than sending them some error? > I would like to place this in the body of my Apache httpd conf file > rather than in the individual VH and Directories. (I assume this is > permissable from what I have read in the docs.) > > The question is; will this conflict with the current use of mod rewrite > that I am using to prevent linking to my .gifs .jpgs .mid, that is also > located in the body of my Apache httpd conf? No, no conflict, but you won't need "RewriteEngine On" on both. > This is a copy from my previous post: > ...snip... > RewriteRule > .*\.(gif|GIF|jpg|JPG|mid|MID|wav|WAV|mp3|MP3|avi|AVI|mpeg|MPEG)$ > - [NC,F] No need to include lower and uppercase versions of each extension in the pattern, as you're using the NC flag. It wouldn't help much either as you run on Windows, and thus the offenders could use URIs such as "something.jPg" to get around it. You don't need the leading ".*" either, it will just slow down pattern matching. Just have it as: RewriteRule \.(gif|jpg|mid|wav|mp3|avi|mpeg)$ - [NC,F] > Finally, is there any particular section in the main body of the Apache > httpd conf that these rewrite rules should be placed? You can probably put it anywhere after mod_rewrite is loaded, but I'd put it just above the VH section. Just a matter of taste. Regards, Robert Andersson --------------------------------------------------------------------- The official User-To-User support forum of the Apache HTTP Server Project. See for more info. To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org " from the digest: users-digest-unsubscribe@httpd.apache.org For additional commands, e-mail: users-help@httpd.apache.org