title: Apache 2.2 ignoring VirtualDocumentRoot VirtualHosts?
body: <p>I have several domains that I would like to have wildcard subdomains enabled for through mod_vhost_alias  </p>
  
  <p>Included in my httpd.conf I have the following generalized rules:  </p>
  
  <pre><code>&lt;VirtualHost [ip here]:80&gt;
      ServerName domain1.com
      ServerAlias www.domain1.com
      DocumentRoot /home/user1/public_html
  &lt;/VirtualHost&gt;
  &lt;VirtualHost [ip here]:80&gt;
      ServerName *.domain1.com
      VirtualDocumentRoot /home/user1/subdomains/%-3+
  &lt;/VirtualHost&gt; 
  
  &lt;VirtualHost [ip here]:80&gt;
      ServerName domain2.com
      ServerAlias www.domain2.com
      DocumentRoot /home/user2/public_html
  &lt;/VirtualHost&gt;
  &lt;VirtualHost [ip here]:80&gt;
      ServerName *.domain2.com
      VirtualDocumentRoot /home/user2/subdomains/%-3+
  &lt;/VirtualHost&gt;
  </code></pre>
  
  <p>The problem is that apache is completely ignoring the virtualhosts with the wildcard ServerNames. Any request for test.domain1.com or test.domain2.com will just show the contents of /home/user1/public_html (the default rule according to apache).  </p>
  
  <h2>Some other information:</h2>
  
  <p><code>/home/user1/subdomains/test</code> and <code>/home/user2/subdomains/test</code> both exist and have files in them  </p>
  
  <p>All my domains have a wildcard subdomain listed in bind config, and they are pointing to the same IP specified in the Vhost rules. Standard Vhost rules for subdomains work, but not wildcard.</p>
  
  <p>A snipped version of the output of <code>httpd -S</code>  </p>
  
  <pre># httpd -S
  VirtualHost configuration:
  [ip here]:80      is a NameVirtualHost
           default server domain1.com (/etc/httpd/sites/user1:1)
           port 80 namevhost domain1.com (/etc/httpd/sites/user1:1)
           port 80 namevhost *.domain1.com (/etc/httpd/sites/user1:14)
           port 80 namevhost domain2.com (/etc/httpd/sites/user2:1)
           port 80 namevhost *.domain2.com (/etc/httpd/sites/user2:14)
  Syntax OK</pre>  
  
  <pre># httpd -M
  Loaded Modules:
   core_module (static)
   mpm_prefork_module (static)
   http_module (static)
   so_module (static)
   rewrite_module (shared)
   auth_basic_module (shared)
   authz_host_module (shared)
   include_module (shared)
   log_config_module (shared)
   logio_module (shared)
   mime_magic_module (shared)
   mime_module (shared)
   vhost_alias_module (shared)
   dir_module (shared)
   suexec_module (shared)
   php5_module (shared)
   suphp_module (shared)
   ssl_module (shared)
  Syntax OK</pre>  
  
  <p>Any suggestions as to what the problem is would be greatly appreciated.</p>