title: Rewrite virtual subdomain to subfolder and keep original url
body: <p>I searched across the web for a few days now but I didn't found any anwser to my question. This is what I want to do:</p>
  
  <p>Every user on my site recieves a personal subdomain like <a href="http://username.domain.com" rel="nofollow">http://username.domain.com</a>.
  Off course this is a virtual subdomain.</p>
  
  <p>Now, I already set up a wildcard DNS A record, turn mod_rewrite ON and achieved to do this:</p>
  
  <p>When somebody surfs to http:// anysubdomain.domain.com they are redirected to http:// www.domain.com/sub/index.php?var=anysubdomain. In the index.php there's a function that gets unique information based on the 'var' variable (the name of the subdomain).</p>
  
  <p>What I want to do is when somebody is surfing to http:// anysubdomain.domain.com he's redirected to http:// www.domain.com/sub/index.php?var=anysubdomain (like it is now) but that the orginal URL (http:// anysubdomain.domain.com) is kept in the browser bar. So it really looks like every user has his own subdomain.</p>
  
  <p>This is the htaccess file I currently use:</p>
  
  <pre><code>RewriteEngine On 
  Options +FollowSymlinks 
  
  
  RewriteCond %{HTTP_HOST} !^www\.domain\.com
  RewriteCond %{HTTP_HOST} !^static\.domain\.com
  RewriteCond %{HTTP_HOST} ^(www\.)?(.+)\.domain.com$ [NC] 
  RewriteRule ^(.*)$ http://www.domain.com/sub/index.php?username=%2 [L]
  </code></pre>
  
  <p>I hope everything is clear, if not: ask and I provide more information!</p>
  
  <p>Thanks in advance!</p>
  
  <p>Yuri</p>