title: Virtual host conf file redirect adds local file path
body: <p>I'm adding the following rewrite to the conf file for my virtual host:</p>
  
  <pre><code>RewriteEngine On
  RewriteCond %{HTTP_HOST} ^example.com
  RewriteRule (.*) http://www.example.com/$1 [R=301,L]
  .... A bunch of aliases here
  </code></pre>
  
  <p>The site works fine with the www. but if you enter the domain without the www. the site will be redirected to www.example.com/home/example/public_html - it adds the file path. How can I prevent this?</p>
  
  <p>Here's the aliases:</p>
  
  <pre><code>Alias /index.php /home/cms/public/index.php
  Alias /skins/admin /home/cms/public/skins/admin
  AliasMatch ^/scripts/(\w+)/admin/(\w+)\.js /home/cms/modules/$1/scripts/admin/$2.js
  AliasMatch ^/scripts/(\w+)/(\w+)\.js /home/cms/modules/$1/scripts/$2.js
  Alias /scripts /home/cms/public/scripts 
  AliasMatch (?i)^/flash/([A-Za-z]*)/([A-Za-z_]*).swf$ /home/cms/public/flash/$1/$2.swf
  Alias /css /home/cms/public/css
  Alias /thirdparty /home/cms/public/thirdparty
  RewriteEngine off
  &lt;Directory /home/cms&gt;
      Order allow,deny
      Allow from all
  &lt;/Directory&gt;
  &lt;Location /&gt;
      RewriteEngine On
      RewriteCond %{REQUEST_FILENAME} -s [OR]
      RewriteCond %{REQUEST_FILENAME} -l [OR]
      RewriteCond %{REQUEST_FILENAME} -d
      RewriteRule ^.*$ - [NC,L]
      RewriteRule ^.*$ /index.php [NC,L]
  &lt;/Location&gt;
  </code></pre>