title: Redirecting subdomain to a folder inside main that contains a CakePHP app
body: <p>Have tried a lot of examples here in SO but none seem to work. Consider my set up:</p>
  <pre><code>/public_html/
       /app/
       /cgi-bin/
       /lib/
       /plugins/
       /revamp/
       /vendors/
  </code></pre>
  <p>I currently have a cakephp website <code>site.com</code> that has its files under <code>/app/</code> folder, and the .htaccess I use right now looks like this:</p>
  <pre><code>&lt;IfModule mod_rewrite.c&gt;  
    RewriteEngine on
  
    ReWriteRule ^$ app/webroot/ [L]
    ReWriteRule (.*) app/webroot/$1 [L]
  &lt;/IfModule&gt;
  </code></pre>
  <p>I want to redirect the subdomain <code>revamp.site.com</code> to the folder <code>/revamp/</code> which would be another cakephp site.</p>
  <h1>UPDATE 1:</h1>
  <p>Been asked to create a vhost and i did, it is set to the subdomain folder, the help I want is for a htaccess rule to work for both, the one above and also redirect to subdomain if the requested address has the subdomain on it before the domain...</p>
  <h1>UPDATE 2:</h1>
  <p>The following <code>.htaccess</code> gets me to my subdomain, but only to the index.html</p>
  <pre><code>&lt;IfModule mod_rewrite.c&gt;
     RewriteEngine on
  
      RewriteCond %{HTTP_HOST} ^site\.com$
      RewriteRule    (.*) app/webroot/$1 [L]
  
      RewriteCond %{HTTP_HOST} ^revamp\.site\.com$
      RewriteRule (.*) revamp/index.html [L]
  &lt;/IfModule&gt;
  </code></pre>
  <p>Its a mix of the two answers...though whatever path I put with subdomain, it only will get me to index.html (as it is hardcoded in the htaccess). Tried also  <code>revamp/$</code> and  <code>revamp/$1</code> with no luck.</p>
  <h1>UPDATE 3:</h1>
  <p>Tried this with edit of first answer:</p>
  <pre><code>&lt;IfModule mod_rewrite.c&gt;
     RewriteEngine on
  
     #subdomain simple site
     RewriteCond %{HTTP_HOST} ^subdomain\.test\.com$
     RewriteCond %{REQUEST_URI} !^/subdomain
     RewriteRule    ^(.*)$ subdomain/$1 [L]
     
     #cakephp site
     RewriteRule    ^$ app/webroot/    [L]
     RewriteRule    (.*) app/webroot/$1 [L]
  &lt;/IfModule&gt;
  </code></pre>
  <p>Still gives a 500, I also tried switching positions of both blocks</p>
  <h1>Update 4:</h1>
  <p>WORKING solution, having both cakephp sites under <code>/public_html/app</code> and <code>/public_html/revamp/app</code></p>
  <pre><code>&lt;IfModule mod_rewrite.c&gt;
     RewriteEngine on
  
     RewriteCond %{HTTP_HOST} ^revamp\.site\.com$
     RewriteRule    ^(.*)$ revamp/app/webroot/$1 [NC,L]
  
     RewriteRule    ^$ app/webroot/    [L]
     RewriteRule    (.*) app/webroot/$1 [NC,L]
  &lt;/IfModule&gt;
  </code></pre>