title: .htaccess - hidding .php and forcing trailing slash not working
body: <p>I'm trying to hide <code>.php</code> extension from my website while forcing trailing slash, I've been searching for the last few days with no success.</p>
  
  <p>The site is running in a XAMPP server currently.</p>
  
  <p>Here's the <code>.htaccess</code> file:</p>
  
  <pre><code>Options -Indexes -Multiviews +FollowSymlinks
  
  RewriteEngine On
  RewriteBase /
  
  #removing .php extension
  RewriteCond %{THE_REQUEST} ^GET\ /[^?\s]+\.php
  RewriteRule (.*)\.php$ /$1/ [L,R=301]
  
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_URI} ^/(.+)/$
  RewriteCond %{DOCUMENT_ROOT}/%1.php -f
  RewriteRule ^(.*)/$ $1.php [L]
  
  #forcing trailing slash
  RewriteCond %{REQUEST_FILENAME}.php -f
  RewriteRule .*[^/]$ $0/ [L,R=301]
  
  ErrorDocument 404 http://localhost/404/
  </code></pre>
  
  <p><strong>These links work:</strong></p>
  
  <p><code>localhost/about-us</code> redirects to <code>localhost/about-us/</code> which is correct but when I try to access <code>localhost/about-us.php</code>, it redirects to <code>localhost/about-us/</code> instead of <code>localhost/about-us/</code>. (sorry can't post links)</p>
  
  <p>How can this be fixed?</p>