httpd-bugs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject DO NOT REPLY [Bug 26052] DOCUMENT_ROOT environment variable set incorrectly with VirtualDocumentRoot
Date Thu, 02 Jun 2011 19:27:02 GMT

--- Comment #31 from Trev Peterson <> 2011-06-02 19:27:02 UTC
This is without question a bug (it is not the desired behavior to have
mod_rewrite and other modules NOT work with mod_vhost_alias).  The question is
whether it is a bug in core apache or the users of it (ex: mod_rewrite and
others).  This in essence breaks mod_rewrite while using mod_vhost_alias.  Yes
it can be worked around using RewriteBase but this is only allowed in the
.htaccess file (per site not en masse) and is a cludge to fix the real issue
(not getting a proper DOCUMENT_ROOT automatically).

Seeing as this is a bug affecting many users (look at the number of
commentsplus it affects almost all drupal, wordpress and other framework sites
that use mod_rewrite to make "clean URLs") I suggest several approaches below
in order of recommendation (#1 is preferred approach):
1. Allow the DocumentRoot directive to take variables so that it can be set
dynamically for things like mod_vhost_alias.  This keeps the definition of
DOCUMENT_ROOT unchanged but allows mod_vhost_alias users to set it properly.  I
don't see how anyone looses with this solution and since it is specifically set
shouldn't cause any backward compatibility issues.
2. Allow the option to change the way apache core defines DOCUMENT_ROOT to use
VirtualDocumentRoot if there is no DocumentRoot directive.  This is in essence
the patch someone from comment #19 if I understand correctly.  This is
basically providing a way of evolving DOCUMENT_ROOT to support a more dynamic
environment.  Having it implemented as a variable would minimize backward
compatibility issues and allow for a smooth transition to the "newer expanded
definition of DOCUMENT_ROOT".  I imagine eventually this switch will be on by
default for almost all sites if this route is taken.
3. Do not change the core at all and transfer this bug to EVERY apache module
that uses DOCUMENT_ROOT so that they implement using VIRTUAL_DOCUMENT_ROOT (or
whatever variable it sets) if DOCUMENT_ROOT is not set.  This will be lots more
coding and seems to be basically punting the issue.  It will also take
considerably longer to get everything working properly since code needs to be
changed in many modules.  I truly hope this is not the suggestion taken but if
the view is nothing is wrong in core and this is just a scripter issue then ALL
the apache modules that use DOCUMENT_ROOT should be updated to check for
VIRTUAL_DOCUMENT_ROOT.  Of course mod_vhost_alias will need to be modified to

To the Devs reviewing this comment:
Many MANY people really want SOME resolution to this issue and it DOES affect a
lot of users.  Please read these suggestions with an open mind and help us get
SOME resolution to this issue.  Suggestion #1 in particular does not require
changing the definition of DOCUMENT_ROOT.  It will require core recoding on the
processing of the directive but you may be able to use the VirtualDocumentRoot
processing code to accomplish this without too much work. This will allow
mod_vhost_alias users to set it (along with VirtualDocumentRoot at first but
likely eventually completely replacing and deprecating VirtualDocumentRoot
altogether) to create fully functional mass virtual hosting.

I have logs from rewriting with and without mod_vhost_alias to show how
mod_rewrite is using DOCUMENT_ROOT and without it it usually loops
continuously.  If you wish to see them let me know and I will attach them.

Configure bugmail:
------- You are receiving this mail because: -------
You are the assignee for the bug.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message