title: Properly redirecting a subdomain to subdirectory invisibly
body: <p>I know similar things have been asked before, but none of the solutions I've found have seemed to work out. I'm by far an expert when it comes to mod_rewrite and it's ilk, so apologies if I'm missing something obvious. </p>
  
  <p>I am trying to invisibly redirect subdomains to an <code>index.php</code> file in a subdirectory; this file takes the value of the subdomain as part of the query string, which is working fine. </p>
  
  <p>The problem I'm having is that now <em>everything</em> in this subdirectory is being redirected to the <code>index.php</code> file, which I don't want to happen. </p>
  
  <p>This is what I have thus far: </p>
  
  <pre><code>RewriteEngine On
  RewriteBase /
  
  # User dashboards
  RewriteCond %{HTTP_HOST} ^(.*)\.example\.com [NC]
  RewriteRule ^.*$ app/index.php?user=%1 [L,NC,QSA]
  </code></pre>
  
  <p>What I'm looking for is a situation where <code>http://subdomain.example.com/</code> will lead to <code>/app/index.php?user=subdomain</code>, but <code>http://subdomain.example.com/assets/stylesheet.css</code> will go to <code>/app/assets/stylesheet.css</code>.</p>
  
  <p>Thanks in advance! </p>