title: wamp local subdomains and htaccess rewrite rules
body: <p>i recently fixed my site up with a bit up php mvc magic for which i use those settings in my .htaccess:</p>
  
  <pre><code>Options +FollowSymLinks
  RewriteEngine On
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-l
  RewriteRule ^([a-zA-Z0-9]*)/?([a-zA-Z0-9]*)?/?([a-zA-Z0-9]*)?/?$ index.php?controller=$1&amp;action=$2&amp;arg=$3 [NC,L]
  </code></pre>
  
  <p>it worked like a charm. the only problem i encountered was that when i reference files like css or images relatively, the browser assumed that we moved down the folder structure due to the dashes in the url
      localhost/projectname/controllername/action/id</p>
  
  <p>so the css/styles.css was requested at localhost/controllername/action/id/css/styles.css
  having absolute paths fixed that problem but didn´t work well with having a localtest server and a remote live and development server after there was no "projectname"- folder</p>
  
  <p>i decided to configure my local wamp server so i can access my different project as a subdomain to my localhost like "<a href="http://projectname.localhost" rel="nofollow">http://projectname.localhost</a>".</p>
  
  <p>i activated the relevant apache modules, edited my hosts file and changed my httpd-vhosts.conf to</p>
  
  <pre><code>NameVirtualHost *:80
  &lt;VirtualHost *:80&gt;
      ServerName localhost.com
      ServerAlias www.localhost.com
      DocumentRoot "C:\wamp\www"
      ErrorLog "logs\errors.log"
      &lt;directory "C:\wamp\www"&gt;
          Options Indexes FollowSymLinks
          AllowOverride all
          Order Deny,Allow
          Deny from all
          Allow from all
      &lt;/directory&gt;
  &lt;/VirtualHost&gt;
  
  &lt;VirtualHost *:80&gt;
      ServerName localhost.com
      ServerAlias *.localhost.com
      VirtualDocumentRoot "C:\wamp\www\subdomains\%1"
      ErrorLog "logs\errors.log"
      &lt;directory "C:\wamp\www\subdomains\%1"&gt;
          Options Indexes FollowSymLinks
          AllowOverride all
          Order Deny,Allow
          Deny from all
          Allow from all
      &lt;/directory&gt;
  &lt;/VirtualHost&gt;
  </code></pre>
  
  <p>now when i call projectname.localhost.com/controllername/action/id it tells me
      The requested URL /subdomains/projectname/index.php was not found on this server.
  while projectname.localhost.com/index.php still supplies me with the right file.</p>
  
  <p>i have heard that there might be a problem with the $_SERVER['DOCUMENT_ROOT'];. that doesn't get set properly but knowing that has not helped me fix that problem yet.</p>
  
  <p>can someone point me into the right direction or suggest another environment configuration that makes testing under those circumstances possible?</p>