4 May 2008 (updated 4 May 2008 at 06:01 UTC)
»
Ran into a weird bug (applies to Apache httpd 1.3.39 and
2.0.40 -- not sure about later 1.x and 2.0.x releases -- but
certainly doesn't apply to 2.2.8, where it appears to work
correctly) where mod_rewrite exposes the absolute path in
the redirect (which then fails).
In a subdirectory off my web root (and root of a virtual
host), I have a .htaccess file:
RewriteEngine On
RewriteCond %{HTTP_HOST} .
RewriteCond %{HTTP_HOST} !^anthonpang\.com [NC]
RewriteRule (.*) http://anthonpang.com/$1 [R,L]
The URL (yes, I left off the trailing slash):
http://example.com/anthonpangcom
Mysteriously becomes:
http://example.com//home/robocoder/public_html/anthonpang
I say mysterious, because the behaviour depends on the
domain I use in RewriteRule. For example, anthonpang.ca
does get rewritten correctly.
That said, it's probably "minor" as I don't expect to
publish or link to the subdirectory-based URL when this goes
"live".