RewriteRule and VirtualDocumentRoot: How do they interract ?
RewriteRule and VirtualDocumentRoot: How do they interract ?
am 14.01.2010 19:45:49 von thomas.preudhomme
--nextPart3665829.CngyuxDnZD
Content-Type: text/plain;
charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
Greetings,
===3D Context ===3D
I recently had to write a rewrite rule and after a few fail, decided to rea=
d=20
carefully online documentation. After understanding the base problem of=20
RewriteRule in .htaccess files (which I did experiment), I put a rule in th=
e=20
vhost config file.
The rule seems to work since the pattern is match and the location is=20
correctly rewrited. What I don't understand is that after the substitution,=
=20
apache look for the file by prepending document_root (/htdocs on my server)=
to=20
the substitution. But I use VirtualDocumentRoot and no DocumentRoot so that=
my=20
files are usually accessed via the value of VirtualDocumentRoot.
So here is the question :
===3D Question ===3D
Why does apache not use the value of VirtualDocumentRoot to prepend=20
RewriteRule substitutions ? I found this bug report=20
https://issues.apache.org/bugzilla/show_bug.cgi?id=3D26052 which seems quit=
e=20
close to what I am experiencing except that users complains more about effe=
cts=20
on PHP scripts.
===3D My server configuration ===3D
VirtualDocumentRoot /srv/www/%-2.0.%-1/%-3+/
RewriteRule ^/(.*)/chapitre-([0-9]*)-([a-z]*)\.poule$=20
/$1/index.php?id=3D$2&lang=3D$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 thi=
s=20
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=20
/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=3D78&lang=3Dfr'
132.227.76.62 - - [14/Jan/2010:18:22:24 +0100] [plume.hadaly.fr/sid#24a33f0]
[rid#279b258/initial] (3) split=20
uri=3D/collections/recherche/sujet/index.php?id=3D78&lang=3D fr ->=20
uri=3D/collections/recherche/sujet/index.php, args=3Did=3D78&lang=3Dfr
132.227.76.62 - - [14/Jan/2010:18:22:24 +0100] [plume.hadaly.fr/sid#24a33f0]
[rid#279b258/initial] (2) local path result:=20
/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=20
/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=20
/htdocs/collections/recherche/sujet/index.php [OK]
The most interesting part to me is the local path result which is coherent =
if=20
it is prepended by the VirtualDocumentRoot value and the message "prefixed =
with=20
document_root".
What does I wrongly assume or understand ?
Thanks for you help or any advice.
Best regards,
Thomas Preud'homme
--nextPart3665829.CngyuxDnZD
Content-Type: application/pgp-signature; name=signature.asc
Content-Description: This is a digitally signed message part.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
iQIcBAABCAAGBQJLT2ZdAAoJENADhS+9UlKeWEoQAJs4kzZ2ZUWuviG6849v yS84
rf0I1xF/EouHc+7d0sjztAYS1gYiY62H4w32lTwY7Qm6piTjllWoSzUoYEPz YpPS
BK1a74XMVje5llWO4+V+ST/lpf2FOmank/xWf7idHIO0oiNHOLF3kYyc7iDF kJfZ
NQIyiLbHi4naJVz9IntzifnaVhuVp6qLwBJOL00OhBP83HrvfXmuZtOUQxWD bqLr
1troMQblVn3NqzIZlZ0SC+GzjRu6ehbkV2qY3g9+7EdFvQpByAHkaf4D2Pjg 1Xr/
CDis2QNKBsDPm2CltgiIFGr+2wzFCpbF5mdY+6aYXgh22cAY75OZoTnUVdRM NuhX
sWxD6ajbU1SxTYqjvL390hz8g+yB5lbmm+FO7cHl2AOC+cpH63nbZfj+X8V5 LLXq
fLwH1y5J5VNR7Uit4xzRbteFDfOJ9X0EX4qhVJVchRfith7V8iW7AXDthgIf FZzA
2dAKRA++ElfjvC5KK9iupRpAK9u7KYoGnqczyiLlkGUxmJIq+vd9fR6I8du5 OH5g
C0NXbLzyvqWJ3r/6ottHuPXwJ7lCteTMOmuhWi4CHaMvj09R+3uZl29SVHMR vx6t
+aioA5jF9J1QYuaNyUPgCq7KWlX/lnYOCJ3eK66wvzT98auKjS8qGppGC9HG GUdH
z5Jfw+UwTdnPNKCM+VXv
=m7Yl
-----END PGP SIGNATURE-----
--nextPart3665829.CngyuxDnZD--
Re: RewriteRule and VirtualDocumentRoot: How do they
am 14.01.2010 19:53:09 von Eric Covener
On 1/14/10, Thomas Preud'homme wrote:
> Greetings,
>
> === Context ===
> 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.
See the PT flag + using a URL-path in your substitution instead of a
filesystem path.
PT is implicit in per-directory. It's what allows "other" modules to
to a URL->filesystem mapping, otherwise they don't see the output of
your rewrite.
--
Eric Covener
covener@gmail.com
------------------------------------------------------------ ---------
The official User-To-User support forum of the Apache HTTP Server Project.
See for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: RewriteRule and VirtualDocumentRoot: How do they interract ?
am 14.01.2010 20:18:37 von thomas.preudhomme
--nextPart3572725.PBU69l8AN0
Content-Type: Text/Plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Le jeudi 14 janvier 2010 19:53:09, Eric Covener a =E9crit :
> On 1/14/10, Thomas Preud'homme wrote:
> > Greetings,
> >
> > ===3D Context ===3D
> > 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.
>=20
> See the PT flag + using a URL-path in your substitution instead of a
> filesystem path.
I thought RewriteRule with a full URL path was striping the http://server p=
art=20
(I get it from the doc). So what is the difference with only matching the=20
remaining part of the URL ? The result of the rule I wrote is a valid URL i=
f=20
prepended by http://myserver
>=20
> PT is implicit in per-directory. It's what allows "other" modules to
> to a URL->filesystem mapping, otherwise they don't see the output of
> your rewrite.
>=20
=46rom the doc :
This flag is just a hack to enable post-processing of the output of Rewrite=
Rule=20
directives, using Alias, ScriptAlias, Redirect, and other directives from=20
various URI-to-filename translators
If I understand well (correct me if I'm wrong), after RewriteRule has appli=
ed,=20
the result is understood as a file path, that's why others directives (such=
as=20
Alias, Redirect and so on) don't apply on the result. But why is the=20
DocumentRoot prepended to the result, is it because it's in the core apache=
=20
and not a module ?
I don't use any of this directives in this vhost (I use them but only for=20
other vhost) for the moment. Is it also valid for handling VirtualDocumentR=
oot=20
?
Sorry for all my questions, I'd rather understand mechanisms that just maki=
ng=20
the change and miss something important.
Best regards,
Thomas Preud'homme
P.S. : This mailing list system should set X-Mailing-List mail header to al=
low=20
proper reply to the list with good MUA
--nextPart3572725.PBU69l8AN0
Content-Type: application/pgp-signature; name=signature.asc
Content-Description: This is a digitally signed message part.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
iQIcBAABCAAGBQJLT24NAAoJENADhS+9UlKel3gP+wXWrY2isogZovy97c+R dRi+
SdHbKZRWobxwcDZndctyvVPoz948kW7b53w+GS1xWpZJgkFC80HgoRDvYlgn nem/
4OTbRgOmNNDMMfHiMM+Ie3CunLSXtJlNq+wTS7rVw3++AKSOImhZcXP/GrDu 0ciM
bJI0SIVTjgR/zSpY5io9HBHbIurkYgNw9MfwViSdvcu/gS0ywWRFK9HBGffg kFrv
FVAH47aJ7sBLXTgrCjoirc4bK7Q1B0EU3mZWB/Pbp8xK3kQTSHKhloZn9f6L /3br
YZ6DTKgCIJgL1wS/11lyGH1tzfyM62k9fgVTm/wDdmdjNu7asry7RbV+sSyW u3HV
wfbEyJ7rKDfHfyxtC0YR8dhdZqHQSs4hDGPPxorljfqSu7pSuzhMJ/yAiv4/ O64W
MXP/puzREqsHZQZ8Ilgst994L6K8bZFU+ADQEGxRT7KVbtcsODEz+fYicZgq 7HuQ
XXoQ6iFUkDrrVRiGcg8mBH9956BnGnDEpfQajQ6YG7aSQ6Pj7tnPbTONoIo+ QTYp
CViThh0tCGyf5RrMR8Kbib1OOrSL96zjdclqC1zWnT5BVGllO7ceI7+Zx1DX aqsD
rEp+SewA9vdXiwL2NmPLNlEsnXO/2s/VNqCHKMiI3juBhZw4ArZld41hW/Q2 GzUN
D/YDqoK/WS9hUXvceWPh
=orX7
-----END PGP SIGNATURE-----
--nextPart3572725.PBU69l8AN0--
RE: RewriteRule and VirtualDocumentRoot: How do theyinterract ?
am 15.01.2010 18:23:32 von Oliver Schoenborn
> From the doc :
>=20
>=20
> This flag is just a hack to enable post-processing of the output of
> RewriteRule directives, using Alias, ScriptAlias, Redirect, and other
> directives from various URI-to-filename translators
>=20
> If I understand well (correct me if I'm wrong), after RewriteRule has
> applied, the result is understood as a file path, that's why others
> directives (such as Alias, Redirect and so on) don't apply on the
> result. But why is the DocumentRoot prepended to the result, is it
> because it's in the core apache and not a module ?
The rewriterule transforms a URI into a new URI.=20
------------------------------------------------------------ ---------
The official User-To-User support forum of the Apache HTTP Server Project.
See for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org