RewriteRule and VirtualDocumentRoot: How do they interract ?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Greetings,

=== Context ===

I recently had to write a rewrite rule and after a few fail, decided to read 
carefully online documentation. After understanding the base problem of 
RewriteRule in .htaccess files (which I did experiment), I put a rule in the 
vhost config file.

The rule seems to work since the pattern is match and the location is 
correctly rewrited. What I don't understand is that after the substitution, 
apache look for the file by prepending document_root (/htdocs on my server) to 
the substitution. But I use VirtualDocumentRoot and no DocumentRoot so that my 
files are usually accessed via the value of VirtualDocumentRoot.

So here is the question :

=== Question ===

Why does apache not use the value of VirtualDocumentRoot to prepend 
RewriteRule substitutions ? I found this bug report 
https://issues.apache.org/bugzilla/show_bug.cgi?id=26052 which seems quite 
close to what I am experiencing except that users complains more about effects 
on PHP scripts.

=== My server configuration ===

VirtualDocumentRoot /srv/www/%-2.0.%-1/%-3+/
RewriteRule ^/(.*)/chapitre-([0-9]*)-([a-z]*)\.poule$ 
/$1/index.php?id=$2&lang=$3

URI accessed : http://plume.hadaly.fr/collections/recherche/sujet/chapitre-78-
fr.poule

I don't paste the other informations as they seems to me irrelevant for this 
concern. This rule works with a [R] flag fail with the following logs :

132.227.76.62 - - [14/Jan/2010:18:22:24 +0100] [plume.hadaly.fr/sid#24a33f0]
[rid#279b258/initial] (2) init rewrite engine with requested uri 
/collections/recherche/sujet/chapitre-78-fr.poule
132.227.76.62 - - [14/Jan/2010:18:22:24 +0100] [plume.hadaly.fr/sid#24a33f0]
[rid#279b258/initial] (3) applying pattern '^/(.*)/chapitre-([0-9]*)-([a-
z]*)\.poule$' to uri '/collections/recherche/sujet/chapitre-78-fr.poule'
132.227.76.62 - - [14/Jan/2010:18:22:24 +0100] [plume.hadaly.fr/sid#24a33f0]
[rid#279b258/initial] (2) rewrite '/collections/recherche/sujet/chapitre-78-
fr.poule' -> '/collections/recherche/sujet/index.php?id=78&lang=fr'
132.227.76.62 - - [14/Jan/2010:18:22:24 +0100] [plume.hadaly.fr/sid#24a33f0]
[rid#279b258/initial] (3) split 
uri=/collections/recherche/sujet/index.php?id=78&lang=fr -> 
uri=/collections/recherche/sujet/index.php, args=id=78&lang=fr
132.227.76.62 - - [14/Jan/2010:18:22:24 +0100] [plume.hadaly.fr/sid#24a33f0]
[rid#279b258/initial] (2) local path result: 
/collections/recherche/sujet/index.php
132.227.76.62 - - [14/Jan/2010:18:22:24 +0100] [plume.hadaly.fr/sid#24a33f0]
[rid#279b258/initial] (2) prefixed with document_root to 
/htdocs/collections/recherche/sujet/index.php
132.227.76.62 - - [14/Jan/2010:18:22:24 +0100] [plume.hadaly.fr/sid#24a33f0]
[rid#279b258/initial] (1) go-ahead with 
/htdocs/collections/recherche/sujet/index.php [OK]

The most interesting part to me is the local path result which is coherent if 
it is prepended by the VirtualDocumentRoot value and the message "prefixed with 
document_root".

What does I wrongly assume or understand ?

Thanks for you help or any advice.

Best regards,

Thomas Preud'homme

Attachment: signature.asc
Description: This is a digitally signed message part.


[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux