Virtual hosts ... yet again to

Discussion in 'Server Operation' started by wiremind, Jun 2, 2006.

  1. wiremind

    wiremind New Member

    I've spent a lot of time looking for a solution for this problem but havent had any luck getting it to work. So here it goes. I have the following directory structure for my users:


    My virtual host looks like this


    UseCanonicalName off
    VirtualDocumentRoot /home/users/%2+/%1
    VirtualScriptAlias /home/users/%2+/%1


    So basically when a user goes to he'll get the content of /home/users/ When he goes to, he'll get /home/users/ So far so good, everything works fine as long as there is a "www" prefix in the url. However when user goes to i get a 404 error since the requested directory becomes /home/users/com/domain1 which is obviously incorrect.

    Is there a way to add "www" for all domains that do not include "www" such as => I've tried a bunch of rewrite rules but they did not seem to work. Anyone knows a solution? Thanks.
  2. falko

    falko Super Moderator Howtoforge Staff

    Why don't you create a vhost for each of your site with a hardcoded document root?
  3. wiremind

    wiremind New Member

    Because i have hundreds of them and i need to automate it all.
  4. QpoX

    QpoX New Member

    mod_perl and a script that takes the domains from a file or db?

Share This Page