title: apache map single subdomain to folder
body: <p>In my <code>/var/www</code> I have a number of sites (goodsite, badsite, uglysite). Right now they are accessed by <code>mydomain.com/goodsite</code>, etc..</p>
  
  <p>What I want is for one site in particuar, uglysite, to be accessed by <code>uglysite.mydomain.com</code> - the others remain as they are.</p>
  
  <p>I have tried all sorts of ways of fiddling with the.htaccess (in <code>/var/www</code>). Note I have mod-rewrite enabled and mod vhost-alias enabled.</p>
  
  <pre><code>RewriteEngine on
  RewriteCond %{HTTP_HOST} ^uglysite\.mydomain\.com$ [NC]
  RewriteCond %{REQUEST_URI} !^/uglysite/
  RewriteRule ^(.*)$ /uglysite/$1 [L]
  </code></pre>
  
  <p><strong>What ends up happening is that both mydomain.com and uglysite.mydomain.com always map to the same thing</strong> (i.e., the index at <code>/var/www</code>). I tried adding in a new virtual host, and was surprised to find that uglysite.mydomain.com mapped correctly, but then mydomain.com also mapped directly to uglysite as well.</p>
  
  <pre><code>&lt;Virtualhost uglysite.mydomain.com:80&gt;
         ServerName uglysite.mydomain.com
         ServerAdmin www@localhost
         DocumentRoot "/var/www/"
         AccessFileName .htaccess
         &lt;Directory "/var/www/uglysite"&gt;
                 Order allow,deny
                 Allow from All
                 AllowOverride All
         &lt;/Directory&gt;
  &lt;/VirtualHost&gt;
  </code></pre>
  
  <p>The above was added to my sites-enabled/000-default file. This got uglysite.mydomain.com to work properly, but then mydomain.com mapped to the same thing! </p>
  
  <p>Is there a straightforward way to do what I'm intending to do?? Thanks in advance.</p>