Return-Path: Delivered-To: apmail-httpd-users-archive@www.apache.org Received: (qmail 68516 invoked from network); 7 Oct 2007 19:12:11 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 7 Oct 2007 19:12:11 -0000 Received: (qmail 90493 invoked by uid 500); 7 Oct 2007 19:11:49 -0000 Delivered-To: apmail-httpd-users-archive@httpd.apache.org Received: (qmail 90477 invoked by uid 500); 7 Oct 2007 19:11:49 -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: List-Id: Delivered-To: mailing list users@httpd.apache.org Received: (qmail 90466 invoked by uid 99); 7 Oct 2007 19:11:49 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 07 Oct 2007 12:11:49 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of sterickson@gmail.com designates 209.85.198.187 as permitted sender) Received: from [209.85.198.187] (HELO rv-out-0910.google.com) (209.85.198.187) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 07 Oct 2007 19:11:51 +0000 Received: by rv-out-0910.google.com with SMTP id l15so494244rvb for ; Sun, 07 Oct 2007 12:11:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; bh=mxoxn/9pQIDBv1BI5S4sRGqw/EvJ20bpmHkoJSvgP8g=; b=UxAC3bE5tozRD41+LxVbFUVyDfH4ClOiOXPEFiB4rFc0iTqWyzmS7QkZudTS4DIo4n5nyK+AasTwtPlRohsZGAKwqUwKh6L4k5urC5qChGrM1Lrxoa/3F8o1NkvyD7Fl8zrNCDeegMJ/HXxdF2hd3kLeA4RvudwdJgzP10JH8bI= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=ZQF4T3tQBq5OZuhiGEPXUCVFsPIdeOw2e67519eJe5jKy8PnUjQQQlIneXP+EMM6qXUA3RN29dPusAJFvTSuDFFwHx90qywBTzgFfF0f7darInW7XuiaTCxbIGCIF1t/TgohAadued9v5NmbYjAbVXaLBT/Tik0cK/qLYJxSiBw= Received: by 10.140.147.5 with SMTP id u5mr235754rvd.1191784289501; Sun, 07 Oct 2007 12:11:29 -0700 (PDT) Received: by 10.141.201.11 with HTTP; Sun, 7 Oct 2007 12:11:29 -0700 (PDT) Message-ID: <92da24e00710071211s5b605dc1vd4221005a3dc440f@mail.gmail.com> Date: Sun, 7 Oct 2007 15:11:29 -0400 From: "Shaun T. Erickson" To: users@httpd.apache.org In-Reply-To: <92da24e00710070751u72a12a0doca4fe359fccbea94@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <92da24e00710070751u72a12a0doca4fe359fccbea94@mail.gmail.com> X-Virus-Checked: Checked by ClamAV on apache.org Subject: [users@httpd] Re: Struggling with Apache 2.0.54 & mod_rewrite On 10/7/07, Shaun T. Erickson wrote: > I have been scratching my head over this for hours ... > > I'm trying accomplish this: > > If the UserAgent is not ABCD, and the request is for either /dir1/ or > /dir1-test/ then it should be rewritten to /dir1/info/ > > The idea is that only UAs of ABCD should get served the index file in > /dir1/ or /dir1-test/ and all others should get served the index file > in /dir1/info/ instead. > > Additionally, if the UA is not ABCD and they explicitly request the > index file by name, in either directory, they should also get > redirected to /dir1/info/ > > It isn't clear to me whether the directives belong in /.htaccess or in > /dir1/.htaccess and /dir1-test/.htaccess and I'm still struggling to > come up with the right directives as well. > > There are already .htaccess files in /dir1/ and /dir1-test/ that > define what the index file for that directory is, and that works fine. > The index file in the info dir is just index.html. I came up with this, which works: RewriteEngine On RewriteCond %{HTTP_USER_AGENT} CFNetwork [OR] RewriteCond %{HTTP_USER_AGENT} AppTapp RewriteRule ^iphone-apps-test/$ iphone-apps-test/repo.cache [L] RewriteRule ^iphone-apps-test/$ iphone-apps/info/ [L] RewriteCond %{HTTP_USER_AGENT} CFNetwork [OR] RewriteCond %{HTTP_USER_AGENT} AppTapp RewriteRule ^iphone-apps/$ iphone-apps/repo.cache [L] RewriteRule ^iphone-apps/$ iphone-apps/info/ [L] I am wondering if there is anyway to collapse this further, however. -- -ste --------------------------------------------------------------------- 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