title: .htaccess double rewrite rule to the same file
body: <p>I'm making an app where you can store files in folders and so on.</p>
  
  <p>I have a little problem in my .htaccess file cause I want to be able to redirect two rules to the same page, one with a attribute on without.</p>
  
  <p>I want <code>example.com/drive</code> to reqrite itself to <code>example.com/drive.php</code> and it does so this part works, but I also want <code>example.com/drive/path/to/a/dir/here/</code> to rewrite itself to <code>example.com/drive?dir=drive/path/to/a/dir/here/</code> .</p>
  
  <p>Is this possible with a .htaccess file? And if it is, how?</p>
  
  <p>This is the code I got so far:</p>
  
  <pre><code>DirectoryIndex home.php
  DirectoryIndex index.php
  
  ErrorDocument 404 /err/404.php
  ErrorDocument 500 /err/500.php
  
  Options +FollowSymlinks
  RewriteEngine On
  RewriteBase /
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_FILENAME}.php -f
  RewriteRule ^(.+)$ /$1.php [L,QSA]
  RewriteRule ^u/(.+)$ /profile.php?u=$1 [L,QSA]
  RewriteRule ^f/(.+)$ /file.php?f=$1 [L,QSA]
  RewriteRule ^s/(.+)/(.+)$ /page.php?p=$1&amp;f=$2 [L,QSA]
  RewriteRule ^s/(.+)$ /page.php?p=$1 [L,QSA]
  RewriteRule ^dir/(.+)$ /drive.php?dir=$1 [L,QSA]
  </code></pre>
  
  <p>This code works by using dir not drive in the url, but that is not what I want.</p>
  
  <p>Thanks in advance</p>