4 May 2008 robocoder   » (Journeyer)

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".

Latest blog entries     Older blog entries

New Advogato Features

New HTML Parser: The long-awaited libxml2 based HTML parser code is live. It needs further work but already handles most markup better than the original parser.

Keep up with the latest Advogato features by reading the Advogato status blog.

If you're a C programmer with some spare time, take a look at the mod_virgule project page and help us with one of the tasks on the ToDo list!