Lately I have added the tail of the file to optimize url's like site/5/john-doe[.php] rather than site/5/john-doe/[index.php], however, I rather like my custom error documents, which modifications call a black &lifier whitened "Internal Server Error" and "additional 404" error page. It may be useful to understand that the majority of the site will stay within the old, directory-oriented format, and should exist together using the new file-oriented system. Appreciate your help.

<Files .htaccess>
order allow,deny
deny from all
</Files>

Options -Indexes

ErrorDocument 403 /errors/forbidden.php
ErrorDocument 404 /errors/notfound.php

#AddType 'text/html; charset=UTF-8' html php

# If you want Apache to use index.rhtml in addition to index.php etc.
DirectoryIndex index.rhtml index.php index.html index.htm

AddHandler rubypage .rhtml
Action rubypage /scripts/erb.cgi

RewriteEngine On

RewriteBase /

RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule ^(.*)$ $1.php [L,QSA]

Do this:

RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule !\.php$ %{REQUEST_URI}.php [L,QSA]