if the DocumentRoot directive is specified, then DOCUMENT_ROOT uses the directive's value. if the VirtualDocumentRoot directive is specified, then DOCUMENT_ROOT still uses the directive's value. if the VirtualDocumentRoot directive is specified and DocumentRoot is not specified, then DOCUMENT_ROOT uses /apache/htdocs. The conf info below uses the plain-vanilla httpd.conf with an include at the bottom that uses the information below. ------------------------------------------------------------ UseCanonicalName Off LogFormat "%V %h %l %u %t \"%r\" %s %b" vcommon <Directory /web/www/> Options FollowSymLinks AllowOverride All </Directory> <VirtualHost 38.117.191.236> ServerName dev.posneradv.net CustomLog logs/access_mass.log vcommon VirtualDocumentRoot "c:/web/www/%1/" </VirtualHost>
Is this a bug? It seems to me that this is the desired behavoir. mod_vhost_alias should not change the DOCUMENT_ROOT, rather it acts as a ap_hook_translate_name(), only translating the requested vhost into a path. -Paul Querna
No, it isn't. DOCUMENT_ROOT is one of the most useless variables, since it doesn't (and cannot!) map things like Alias, RewriteRules, Userdir etc. mod_vhost_alias falls unders the alias/rewrite category (technically and also on a higher level of abstraction). -> wontfix.
Hi! > No, it isn't. DOCUMENT_ROOT is one of the most useless variables, since it > doesn't (and cannot!) map things like Alias, RewriteRules, Userdir etc. How can you jugde on the needs of the administrator of an apache system? In our configuration DOCUMENT_ROOT would be a very, very usefull variable because I can't get the real filesystem path to the mod_vhost_aliased with any other variable, can I? I think, not setting DOCUMENT_ROOT for a mod_vhost_aliased VHOST is a bug, not a feature that have to be fixed. Otherwise we have to drop mod_vhost_alias and have to return to real vhosts and much "apache2ctrl graceful" restarts of the Apache2. This should not be solution, or? Regards, ChrisDi
This cannot be called a bug, but only an enhancement request. According to http://httpd.apache.org/docs/2.0/vhosts/mass.html#overview DOCUMENT_ROOT cannot be used in this situation. If you need to know the document root in an environment variable please use mod_rewrite for mass virtual hosting (http://httpd.apache.org/docs/2.0/vhosts/mass.html#simple.rewrite) and set a custom variable using the E flag of mod_rewrite (DOCUMENT_ROOT cannot be overwritten).
Hi, a little precious than ChrisDi: He/we use shtml files and therefore the DOCUMENT_ROOT is needed! Even vor RewriteRules DOCUMENT_ROOT is useful - we have multiple Domains with Typo3 installations and with the old apache1 the rules won't fit without this variable - only with this writing: RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-f RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-d RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-l RewriteRule .* /index.php Greets Reiner
That last comment is an excellent example of why DOCUMENT_ROOT symantics should not be changed. Two reasonable people could have two completely different ideas about what the "proper" value for DOCUMENT_ROOT in those rules is. If you start playing around with this, there is really no way to consistently predict what will be in DOCUMENT_ROOT, since it would change based on the phase of processing. Making available a VIRTUAL_DOCUMENT_ROOT variable would seem like a sensible alternative. But this bug is a dupe, so please direct your propsed patches to bug 26052. *** This bug has been marked as a duplicate of 26052 ***