title: third level domain
body: <p>I'm creating a series of third level domain with php using Virtualmin API (and till here all's right). I need a solution to serve to each of these subdomains the corresponding subdirectory, that is <br>sub1.domain.com goes in C:\xampp\htdocs\domain_com\subsites\sub1; <br>sub2.domain.com => C:\xampp\htdocs\domain_com\subsites\sub2. <br>I should do this with Virtualmin API, too, but then the user can see the subdirectory in which he is redirected, and it is bad. Subdomain should be converted in subdirectories with a general solution in httpd.conf to not modifying and restarting Apache continuosly. In the meanwhile the URL showed to the user must remain "sub1.domain.com/whatever_dir/user_file.php". 
  I've tried to obtain it with RewriteRule like these ones:</p>
  
  <pre><code>&lt;VirtualHost *:80&gt;
      ServerName www.domain.com
      ServeAlias *.domain.com
      DocumentRoot C:/xampp/htdoc/domain_com/
      Option +FollowSymLinks
      RewriteEngine On
      RewriteCond %{HTTP_HOST} !^www.domain.com
      RewriteCond %{HTTP_HOST} ^(w*).domain.com
      RewriteRule ^$ subsites/%1%{REQUEST_URI}
  &lt;/VirtualHost&gt;
  </code></pre>
  
  <p>With this rule i succeded to call all files in '%1' directory. But if anyone of these files calls a picture or any other resource the path of this resource refers always to the document root, not to the calling file. So the file is correctly called but with wrong resource paths!!! </p>
  
  <p>And it makes so with Alias, AliasMatch, too. I begin to realize that Alias and RewriteRules are not the right means for this goal but i don't know any other ones.</p>
  
  <p>Thanks for attention. I hope someone have a suggestion.
  Emanuele.</p>