title: Apache .htaccess Rewrite Query String with slashes
body: <p>I am trying to figure out Apache's Mod Rewrite and so far it's not working.  Here is what I am trying to do.</p>
  
  <p>I have an index.php in the root directory of my site that is a template for all pages.  I want to be able to organize my files in directories and the query string will have slashes.</p>
  
  <p>So...</p>
  
  <pre><code>http://www.example.com/page.html
  </code></pre>
  
  <p>should be...</p>
  
  <pre><code>http://www.example.com/index.php?url=page
  </code></pre>
  
  <p>and...</p>
  
  <pre><code>http://www.example.com/directory/page.html
  </code></pre>
  
  <p>should be...</p>
  
  <pre><code>http://www.example.com/index.php?url=directory/page
  </code></pre>
  
  <p>I've got that working but I want to be able to go <em>n</em> directories deep...</p>
  
  <pre><code>http://www.example.com/directory1/directory2/page.html
  </code></pre>
  
  <p>should be...</p>
  
  <pre><code>http://www.example.com/index.php?url=directory1/directory2/page
  </code></pre>
  
  <p>I know I could just put a bunch of rewrites for however many directories I deep I want to go, but is there a single line RewriteRule that will put anything after the first / will be considered a query string?</p>
  
  <p>This is what I have so far...</p>
  
  <pre><code>RewriteEngine on
  RewriteRule ^([a-z-]+)\.html$ index.php?url=$1
  RewriteRule ^faculty/([a-z-]+)\.html$ index.php?url=faculty/$1
  </code></pre>
  
  <p>Behind the scenes, PHP is including the file that is in the location that the url is specified.</p>