How do I get subdomain's to work on a multisite install? I am able to get multisites working with different domains, but have not had luck with any subdomain sites working. For example If I had http://example.com and http://www.example.com resolving correctly to ./sites/example.com and wanted to have http://subdomain.example.com and or http://www.subdomain.example.com resolving to ./sites/subdomain.example.com, how would I go about that?

Here are the vhosts I have tried for www.example.com:

<VirtualHost *>
        ServerAdmin email@example.com
        ServerName www.example.com
        ServerAlias example.com
        DocumentRoot /var/www/drupal6
        <Directory /var/www/drupal6>
                Options +Includes +Indexes +FollowSymLinks
                AllowOverride All
                RewriteEngine on
                        RewriteBase /
                        RewriteCond %{REQUEST_FILENAME} !-f
                        RewriteCond %{REQUEST_FILENAME} !-d
                        RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
        </Directory>
        ErrorLog /var/log/apache2/example.com-error.log
        LogLevel warn
        CustomLog /var/log/apache2/example.com-access.log combined
        ServerSignature Off
</VirtualHost>

The vhost I am using attempting to get this to work with, http://subdomain.example.com, follows:

<VirtualHost *>
        ServerAdmin email@example.com
        ServerName subdomain.example.com
        DocumentRoot /var/www/drupal6/
        <Directory /var/www/drupal6/>
                Options +Includes +Indexes +FollowSymLinks
                AllowOverride All
                RewriteEngine on
                        RewriteBase /
                        RewriteCond %{REQUEST_FILENAME} !-f
                        RewriteCond %{REQUEST_FILENAME} !-d
                        RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
        </Directory>
        ErrorLog /var/log/apache2/subdomain.example.com-error.log
        LogLevel warn
        CustomLog /var/log/apache2/subdomain.example.com-access.log combined
        ServerSignature Off
</VirtualHost>

I have tried setting up an A-NAME and a CNAME for subdomain.example.com but the site only resolves to www.example.com. Any ideas what I am doing wrong here?
Thanks

Comments

Andy1981’s picture

I haven't yet tried to install multi sites, but I've been reading up on it because I'm about to do it - also with subdomains. I came across the following which might help:

http://drupal.org/node/107347

Halfway down is a section on multi sites with subdomains.

I also remember reading something about replacing www for multisites, but I couldn't find it right now.