Reputation: 15032
I have a site in a subfolder in which I have a .htaccess file which works quite fine, but if the rules dont find anything, it raises a 500 internal server error istead of 404, however I thought I would solve it by adding a 500 Error document, but the 500 Error page (aside from classic 500 message) says:
"Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request."
So I have a two questions:
This is my .htaccess so far:
DirectorySlash On
RewriteEngine On
RewriteBase /mysubdir/
ErrorDocument 404 /mysubdir/404.php
ErrorDocument 500 /mysubdir/500.php
RewriteRule ^folderexcludedone(/|$) - [NC,L]
RewriteRule ^folderexcludedtwo(/|$) - [NC,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/.]+)$ $1/ [L,R]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^/]+)/?$ $1.php [L,QSA]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^/]+)/([^/]*)/?$ $1.php?$1=$2 [L,QSA]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^/]+)/([^/]+)/([^/]*)/?$ $1.php?$2=$3 [L,QSA]
Upvotes: 1
Views: 315
Reputation: 785541
Try these rules:
DirectorySlash On
RewriteEngine On
RewriteBase /mysubdir/
ErrorDocument 404 /mysubdir/404.php
RewriteRule ^(folderexcludedone|folderexcludedtwo)(/|$) - [NC,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/.]+)$ $1/ [L,R]
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d [OR]
RewriteCond %{REQUEST_FILENAME}.php !-f
RewriteRule ^ - [L]
RewriteRule ^([^/]+)/?$ $1.php [L,QSA]
RewriteRule ^([^/]+)/([^/]+)/?$ $1.php?$1=$2 [L,QSA]
RewriteRule ^([^/]+)/([^/]+)/([^/]+)/?$ $1.php?$2=$3 [L,QSA]
Upvotes: 1