Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I'm using the below to set a client env variable which my system requires.

SetEnvIf HOST "^(\w+).domain.com" CLIENT_ID=$1
UseCanonicalName Off
VirtualDocumentRoot /home/user/clients/%-3/

I'm including this in a vhost.conf on my main domain and it seems to be working, however the DOCUMENT_ROOT isn't being set on line 3 - it remains as the main domain doc root. I've tried with and without UseCanonicalName Off

What's missing here from this config? I can load files under the document root but the SERVER['DOCUMENT_ROOT'] is always /usr/local/apache/htdocs

I also need this config to 404 correctly if the folder under 'clients' doesn't exist.


I should note that our systems allows all sites to run from a single index.php which is aliased in another virtual host include as:

Alias /index.php /home/public/index.php

This means content is served using the above config, and correctly, just the doc root isn't being set correctly.


It looks like this https://issues.apache.org/bugzilla/show_bug.cgi?id=26052 is my document root problem.

Will try to update and come back with my findings.

share|improve this question
So it's serving content from somewhere other than the VirtualDocumentRoot? Do you have both that and a DocumentRoot defined? Why is it configured in that way, and can you provide the full config? –  Shane Madden Jul 11 '12 at 21:51
@ShaneMadden I updated the question to include my explanation –  Ashley Jul 11 '12 at 21:54
Gotcha, makes sense. Are you seeing the wrong docroot in what's passed to PHP, or in content that's served that isn't handled by index.php? –  Shane Madden Jul 11 '12 at 21:58
The content being served through the index.php gives the wrong doc root. –  Ashley Jul 11 '12 at 22:11

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.