Article View: best.general
Article #357Redirects post-migration
From: Michael Han
Date: Mon, 22 Oct 2001 06:52
Date: Mon, 22 Oct 2001 06:52
33 lines
2232 bytes
2232 bytes
A long time ago, I stopped using my Best account for web hosting and put some Redirect rules in my .bhtaccess files to point at my new site. I think someone automagically converted .bhtaccess files to Apache-compliant .htaccess files resulting in subtle breakage. I had a bunch of rules for: Redirect /foo.html http://www.example.com/foo.html Redirect /bar.html http://www.example.com/bar.html followed by a catchall: Redirect / http://www.example.com/ Unfortunately, the mod_rewrite rules that replaced my Redirect rules work differently as written: RewriteRule ^/foo.html(.*)$ http://www.example.com/foo.html$1 [R] isn't quite the same, because subsequent rules are tested and applied. The final rule: RewriteRule ^(.*)$ http://www.example.com/$1 [R] isn't right because the prior rules were meant to be [R,L] rules that short-circuit to the end of mod_rewrite's execution. This way, the catch-all rule still gets applied, totally munging the request into something like http://www.example.com/http://www.example.com/foo.html So pay attention if you were using Redirect-type commands in your .bhtaccess files. There are some corner cases where the wrong thing might be happening. -- mikehan+&$#^@best.com
Technical Details
Message-ID:
<slrn9t7ghb.e7d.mikehan+&$#^@shell7.ba.best.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!supernews.com!newsfeed.direct.ca!look.ca!news-peer-west.sprintlink.net!news.sprintlink.net!enews.sgi.com!news1.best.com!nntp1.ba.best.com!mikehan+&$#^Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f9f6d,147baee94542f82e,start X-Google-Attributes: gidf9f6d,public X-Google-ArrivalTime: 2001-10-21 23:52:33 PST Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!supernews.com!newsfeed.direct.ca!look.ca!news-peer-west.sprintlink.net!news.sprintlink.net!enews.sgi.com!news1.best.com!nntp1.ba.best.com!mikehan+&$#^ From: mikehan+&$#^@best.com (Michael Han) Newsgroups: best.general Subject: Redirects post-migration Followup-To: best.general Date: Mon, 22 Oct 2001 06:52:27 +0000 (UTC) Organization: The ISP formerly known as Best Lines: 33 Distribution: best Message-ID: <slrn9t7ghb.e7d.mikehan+&$#^@shell7.ba.best.com> Reply-To: mikehan+&$#^@best.com NNTP-Posting-Host: shell7.ba.best.com X-Trace: nntp1.ba.best.com 1003733547 64445 206.184.139.138 (22 Oct 2001 06:52:27 GMT) X-Complaints-To: abuse@best.com NNTP-Posting-Date: Mon, 22 Oct 2001 06:52:27 +0000 (UTC) User-Agent: slrn/0.9.6.2 (FreeBSD)