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.

1 Answer 1


mod_rewrite is probably what you're looking for.

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

You must log in to answer this question.