title: Rewriting URLs that work from subfolder and root
body: <p>I building a site that has SEO friendly URLs, the URLs on the live site look something like: <a href="http://www.somesite.com/seo/friendly/url" rel="nofollow">http://www.somesite.com/seo/friendly/url</a></p>
  
  <p>I also have a staging server that I am using to test the site. On this server the URLs look something like this : <a href="http://127.0.0.1" rel="nofollow">http://127.0.0.1</a><strong>/~somesite</strong>/seo/friendly/url</p>
  
  <p>Now, SEO urls work on the live site but fail on the test as the substitution in .htaccess captures the /~somesite substring as a variable as well.</p>
  
  <p>How can I begin substitution from where my index.php lives?</p>
  
  <p>Here is the substitution code I am using now:</p>
  
  <pre><code>RewriteRule ^(([\w\-\/])+)$ index.php?page=$1 [L,QSA]
  </code></pre>