title: mod_rewrite pretty urls that may still have a querystring
body: <p>Thanks for taking the time to help!</p>
  
  <p>The scenario is I have mod_rewrite making pretty looking URLs like <code>foobar.com/foo/bar/</code> into ugly ones like <code>foobar.com/bootstrap.php?url=foo/bar</code> and this works wonderfully.</p>
  
  <pre><code>RewriteRule ^([a-z0-9/_]+)$ library/bootstrap.php?url=$1 [L]
  </code></pre>
  
  <p>In some cases (specifically Twitter's OAuth callback) the pretty URL will have a querystring appended to it like <code>foobar.com/foo/bar/?foo=bar&amp;bar=foo</code>. I need the ugly output URL to look like <code>foobar.com/bootstrap.php?url=foo/bar&amp;foo=bar&amp;bar=foo</code>.</p>
  
  <p>Please help as I have no idea what to do! I'll be looking of course as I'm sure some regular expression resource will reveal some clues.</p>
  
  <p>If can come up with an answer please explain it too so I can understand for next time!</p>
  
  <p><strong>Thanks!</strong></p>