title: .htaccess mod_rewrite and Query Strings
body: <p>In my .htaccess file I've got a rule that strips the .php:</p>
  
  <pre><code>RewriteEngine On
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteRule ^([^/]+)/$ $1.php
  RewriteRule ^([^/]+)/([^/]+)/$ /$1/$2.php
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_URI} !(\.[a-zA-Z0-9]{1,5}|/)$
  RewriteRule (.*)$ /$1/ [R=301,L]
  </code></pre>
  
  <p>So, <b>/mydomain.com/page.php</b> becomes <b>/mydomain.com/page/</b> - Which works fine. </p>
  
  <p>Now I'm trying to achieve something similar with query strings, where:</p>
  
  <p><b>/mydomain.com/page.php?variable=value</b> becomes <b>/mydomain/page/value/</b> </p>
  
  <p>I've tried numerous methods and the best I can get is <b>/mydomain/page/?variable=value</b></p>