views:

68

answers:

1

Recently I've added the tail of this file to optimize url's like site/5/john-doe[.php] instead of site/5/john-doe/[index.php], however, I rather like my custom error documents, and these modifications call a black & white "Internal Server Error" and "additional 404" error page. It might be helpful to know that most of the site will remain in the old, directory-oriented format, and must coexist with the new file-oriented system. Thank you for 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]
+1  A: 

Try this:

RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule !\.php$ %{REQUEST_URI}.php [L,QSA]
Gumbo
I kept the "... !-d" line and it works great, thanks
Jesse