httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Robert Andersson" <>
Subject Re: [users@httpd] mod_vhosts_alias + UserDir?
Date Mon, 12 Jan 2004 06:49:07 GMT wrote:
> I'm trying to use VirtualDocumentRoot to use the user home
> directory, the directory structor might look like this for
> (www.)
> /home/davej/vhosts/

I did a similar thing for a friend a while ago, although I haven't had
confirmation if it worked or not, but this might do it:

    <VirtualHost *>
        ServerName anything
        RewriteEngine On
        # If host is only two part, we add www and ask visitor to come again
        RewriteCond %{SERVER_NAME} ^([\w-]+\.[\w-]+)$
        RewriteRule (.*) http://www.%1$1 [R]
        # ...
        VirtualDocumentRoot /home/davej/vhosts/%-2.0.%-1/%-3+
        # Actually, I think you just want this:
        VirtualDocumentRoot /home/davej/vhosts/%-2.0.%-1

This code will redirect to before serving
content (good thing!). Might need some tweaking, I don't know. The original
problem was a bit more complicated, allowing arbitrary number of parts while
only using a fixed directory depth of two, so it might not be optimal for
your problem.

Robert Andersson

The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:> for more info.
To unsubscribe, e-mail:
   "   from the digest:
For additional commands, e-mail:

View raw message