title: Apache virtual host uri with a dir
body: <p>I can not manage to setup a virtual host on url with a subdir ...
  I need to run my project on address like this:</p>
  
  <p><code>http://www.projects.loc/project1/</code>
  This should mimic installation on a web server where the address will be like</p>
  
  <p><code>http://www.someServer.com/projects/project1/</code></p>
  
  <p>I need to adjust the redirects to '/' so it goes back to <code>www.projects.loc/project1/</code></p>
  
  <p>in the hosts.txt I have:</p>
  
  <pre><code>127.0.0.1       www.projects.loc
  </code></pre>
  
  <p>vhosts are enabled and the httpd-vhosts.conf looks like this:</p>
  
  <pre><code>NameVirtualHost *:80
  
  &lt;VirtualHost *:80&gt;
      DocumentRoot "D:/Projects/Project1/public/"         
      ServerName  www.projects.loc/project1/
  &lt;/VirtualHost&gt;
  </code></pre>
  
  <p>What am I missing ?</p>
  
  <p><strong>EDIT:</strong>   .htaccess looks like this:</p>
  
  <pre><code>RewriteEngine On
  RewriteCond %{REQUEST_FILENAME} -s [OR]
  RewriteCond %{REQUEST_FILENAME} -l [OR]
  RewriteCond %{REQUEST_FILENAME} -d
  RewriteRule ^.*$ - [NC,L]
  RewriteRule !\.(js|ico|gif|jpg|png|css)$ index.php [NC,L]
  </code></pre>
  
  <p>the application is running normally on clean domain, but I can not manage to config it to 
  run on domain.com/some_dir/</p>
  
  <p><strong>Edit:</strong><br>
  solved this!  </p>
  
  <pre><code>NameVirtualHost *:80   
  
     &lt;Directory "D:/Projects"&gt; 
        allow from all
     &lt;/Directory&gt;
  
      &lt;VirtualHost *:80&gt;
          DocumentRoot "D:/Projects"      
          ServerName  www.projects.loc/
  
          Alies /project1  /Project1/public/
      &lt;/VirtualHost&gt;
  </code></pre>
  
  <p>Note: this is the minimal configuration good only for development environment,<br>
  check the accepted ansler from @M-z for full details for production evironment.</p>