title: Rewrite rules for mod_rewrite to mimic virtual directories
body: <p>I am running a multi-client application without subdomains. I need to stick to using <em>virtual subfolders</em>:</p>
  
  <p>The application itself is located at:
  <code>example.com/</code></p>
  
  <p>I need the following address pattern to map to the above address:</p>
  
  <p><code>example.com/any-valid-string/*</code> -> <code>example.com/*</code> (<em>without redirect</em>)</p>
  
  <p>For example:</p>
  
  <p><code>example.com/any-valid-string/assets/css/style.css</code></p>
  
  <p>actually resolves physically to </p>
  
  <p><code>example.com/assets/css/style.css</code></p>
  
  <p>I am working now with a hard-coded client name, for example called "sample" this does the trick:</p>
  
  <pre><code>RewriteRule ^sample/?(.*)$ $1 [QSA,NS,L]
  </code></pre>
  
  <p>I need the "sample" part also dynamic, I tried the following but without success:</p>
  
  <pre><code>RewriteRule ^([^/]+)/?(.*)$ $2 [QSA,NS,L]
  </code></pre>