From owner-freebsd-questions@FreeBSD.ORG Fri Sep 28 22:24:34 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 E5F9F106566B for ; Fri, 28 Sep 2012 22:24:33 +0000 (UTC) (envelope-from gibblertron@gmail.com) Received: from mail-ie0-f182.google.com (mail-ie0-f182.google.com [209.85.223.182]) by mx1.freebsd.org (Postfix) with ESMTP id ADF398FC08 for ; Fri, 28 Sep 2012 22:24:33 +0000 (UTC) Received: by ieak10 with SMTP id k10so4312410iea.13 for ; Fri, 28 Sep 2012 15:24:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=J3DzOj7AJrRGIpwt26oaYK9UdqCF7CXH7L59ks6cjfE=; b=G+RfG41bvHChSLYPytTh3E+ydoNhGenv3YOr2Kwx66Hu3jocqWgR+WOpUEO3iCV8aq i3fy+fhPYjXRRYawjnX/YEPfuBNl/KnLGn0fxKO38dwxCAq5RQ46vFRYofiK5TKlfe3o wd9NcNwHMwhd1B7utBgbIrQzyRoke4K3HcvOkq5KBKkqNXMuaGeeB3HKEi2UGu+9akt5 fxWtK7qSM7uYrgBHDO80j7d+QfaL649jhc/QUVvIVf4DAWJJ0nJSeg4z/gj87+yCBVC7 g4k6pPdxZJl4pjYR0l+IiR3TIQJCYxpjeKgnECGGNORownVVGZWAIA/20K52OW6t2wKm +yiw== MIME-Version: 1.0 Received: by 10.50.194.163 with SMTP id hx3mr97710igc.37.1348871073081; Fri, 28 Sep 2012 15:24:33 -0700 (PDT) Received: by 10.42.37.212 with HTTP; Fri, 28 Sep 2012 15:24:33 -0700 (PDT) In-Reply-To: <5066162E.5000108@sage-american.com> References: <506603BC.8000202@sage-american.com> <5066162E.5000108@sage-american.com> Date: Fri, 28 Sep 2012 15:24:33 -0700 Message-ID: From: Patrick To: Jack Stone Content-Type: text/plain; charset=ISO-8859-1 Cc: freebsd-questions@freebsd.org 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 22:24:34 -0000 You can probably do something like: RewriteRule ^([^/])\.html /content/$1.html [PT] ^ inside the square brackets means "not", so a pattern matching anything but /. Or you could be go the other way: RewriteRule ^([a-zA-Z0-9_-]+)\.html /content/$1.html [PT] Where you explicitly include the characters that are used in your html filenames... Patrick On Fri, Sep 28, 2012 at 2:27 PM, Jack Stone wrote: > 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 > > _______________________________________________ > freebsd-questions@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-questions > To unsubscribe, send any mail to "freebsd-questions-unsubscribe@freebsd.org"