From owner-freebsd-questions@FreeBSD.ORG Fri Sep 28 21:26:39 2012 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7F1F8106564A for ; Fri, 28 Sep 2012 21:26:39 +0000 (UTC) (envelope-from jacks@sage-american.com) Received: from mail.sagedata.net (mail.sagedata.net [38.106.15.121]) by mx1.freebsd.org (Postfix) with ESMTP id 3F84A8FC14 for ; Fri, 28 Sep 2012 21:26:38 +0000 (UTC) Received: from [192.168.1.67] (99-111-143-21.lightspeed.crchtx.sbcglobal.net [99.111.143.21]) by mail.sagedata.net (8.14.5/8.14.5) with ESMTP id q8SLQcB9007603 for ; Fri, 28 Sep 2012 16:26:38 -0500 (CDT) (envelope-from jacks@sage-american.com) X-Authentication-Warning: mail.sagedata.net: Host 99-111-143-21.lightspeed.crchtx.sbcglobal.net [99.111.143.21] claimed to be [192.168.1.67] Message-ID: <5066162E.5000108@sage-american.com> Date: Fri, 28 Sep 2012 16:27:10 -0500 From: Jack Stone User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:15.0) Gecko/20120907 Thunderbird/15.0.1 MIME-Version: 1.0 To: freebsd-questions@freebsd.org References: <506603BC.8000202@sage-american.com> In-Reply-To: <506603BC.8000202@sage-american.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Scanned-By: milter-spamc/1.15.388 (mail.sagedata.net [38.106.15.121]); Fri, 28 Sep 2012 16:26:38 -0500 X-Spam-Status: NO, hits=-10.00 required=4.50 X-Spam-Report: Content analysis details: (-10.0 points, 4.5 required) | | pts rule name description | ---- ---------------------- -------------------------------------------------- | -0.0 SHORTCIRCUIT Not all rules were run, due to a shortcircuited rule | -10 ALL_TRUSTED Passed through trusted hosts only via SMTP | Subject: Re: Rewrite redirects X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Sep 2012 21:26:39 -0000 On 9/28/2012 3:08 PM, Jack Stone wrote: > I thought I had this figured out but discovered I have a BIG flaw > with my .htaccess redirects After days of searching and > experimenting, I still can't get this to do what I intended. > > I have moved all of the content on a web site from the web root to a > different directory. Now I need toredirect the URL requests from the > old location to the new one. Instead of issuing a 301 error, I want > to first redirect to an info page, let's call it "info.htm." Here's > what I have now in the web root's .htaccess. > > Here's the way it was/is: > > ~webroot/lots_of.html > ....and now changed to this: > ~webroot/content/lots_of.html > > Using the apache mod_rewritein .htaccess > RewriteEngine on > RewriteRule /~webroot/(.*\.html) /^info.htm [PT] > > ....which is supposed to redirect any page with the extension > ".html" to the info.htm page. BUT, alas any "*.html page in any > directory will redirect back to the info.htm page!! What I wanted is > that only the "*.html pages in the ~webroot to be redirected to the > info page. > > I hope this make sense and I hope someone can give me a tip on how > to limit the redirects to only the webroot pages. > > Thanks in advance..... > For the above, now this works if I use the following: RewriteBase /~webroot/ RewriteRule ^radio\.html$ /^info.htm [PT] RewriteRule ^v20\.html$ /^info.htm [PT] So, now if the above are requested: http://www.webroot/content/radio.html it doesn't redirect to the info page. That's what I want, but there are 100s of "html" files in webroot/content and I figured there MUST be a way to wildcard the syntax, something like ^.*\.html$ so I don't need to list every specific html file. I believe I'll have it if I can figure that out now. Any thoughts? -- -- All the best, Jack