I'm trying to create custom 500 and 404 error pages
here's my .htaccess page:
Options -MultiViews
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !\.php$
RewriteRule ^(.*)$ $1.php [L,QSA]
ErrorDocument 404 "Sorry, this page was not found"
ErrorDocument 500 "Sorry, something went wrong, try again later"
here's a 404 page http://example.com/cats - not a page (but it's showing as a 500)
and this one should be a 500 http://example.com/dogs - a page (because the query returned is blank) but it's not an error message at all - guessing this should be a 500 anyway, i would like it to be
It appears to always show 500 and no 404, but I can't figure out how to stop/fix it, any ideas???
Fixed now
a 500 will only be thrown if there is an exception thrown by php, not by logical errors. a select query returning a blank result isn't considered to be an error by php as sometimes queries will return a blank result as part of the legitimate flow of the code.
with regards to getting a 500 instead of a 400, it appears here http://www.javascriptkit.com/howto/htaccess2.shtml that you should be forwarding to a page rather than trying to pass in a string. set up a page that you want to be displayed and then put the url in your htaccess
like so:
ErrorDocument 500 /errors/serverr.html