title: Rewrite rule not working without trailing slash
body: <p><br><br>I have a working rewrite rule to hide index.php?dir= from the URL.<br>So for instance if I try</p>
  
  <pre><code>www.example.com/folder/dir1/
  </code></pre>
  
  <p>it rewrites it to</p>
  
  <pre><code>www.example.com/folder/index.php?dir=dir1/
  </code></pre>
  
  <p>and that fine!<br><br>The trouble is if I remove the trailing slash from the URL i.e.</p>
  
  <pre><code>www.example.com/folder/dir1
  </code></pre>
  
  <p>it goes into a redirection loop!<br><br>My <b>complete</b> htaccess is:</p>
  
  <pre><code>Options +FollowSymLinks 
  
  RewriteEngine On
  RewriteBase /folder
  
  RewriteCond %{ENV:REDIRECT_STATUS} 200
  RewriteRule .* - [L]
  
  RewriteCond %{QUERY_STRING}  ^dir=(.*)$ [NC]
  RewriteRule ^ %1? [L,R=301,NE]
  
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} -d
  
  RewriteRule ^(.+)/? index.php?dir=$1 [L,QSA]
  </code></pre>
  
  <p>Please advice?</p>