Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

SetEnvIf HOST "^(\w+)" 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 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.