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

Is this even possible?

Say I have a server, devbox.local, which has several HTTP auth users: alan, bill, carl. What I'm trying to do is tell Apache to use a different DocumentRoot depending on who is logged in at the time. So user alan might see a docroot from /var/www/html, bill might see /home/bill/public_html, and carl might see some other directory entirely.

I know some of you will jump straight to the "use mod_userdir for this" response, but that would create URLs in the form http://devbox.local/~bill/whatever -- which is not what we want. (Each user will be working on a separate copy of a web app that reeeeally doesn't like not being in the domain's root directory. Believe me, we've tried.)

I'm also trying to avoid using subdomains unless there's no other alternative, as I really don't want to have to hork around with our vhosts/DNS/hosts files if (when) we move things around later.

share|improve this question

mod_rewrite is probably what you're looking for.

Check the documentation on how to use the %{REMOTE_USER} variable to rewrite the URL.

share|improve this answer

Your Answer


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