1

So I'm trying to create a custom error page which will basically be an umbrella for all errors. However, I need to know how to output the specific error code returned for this.

I've searched, but it's starting to look like it's impossible without using PHP. If this is indeed the case, is there a danger of using PHP and then having the request fail before the PHP parser goes through the code? Maybe my logic is a tad backward, but I've seen people handle 500 errors with custom error documents, and I'm already a tad confused when it comes to the order in which the server processes the different parts of the request.

Any help would be appreciated!

2 Answers2

0

using htaccess you can trace error

i.e

ErrorDocument 400     /400.html
ErrorDocument 401     /401.html
ErrorDocument 403     /403.html
ErrorDocument 404     /404.html
ErrorDocument 500     /500.html
  • I know about routing the errors through .htaccess, but right now I'm concerned with outputting the error code on the document. As I said, I'll be using "a custom error page which will basically be an umbrella for all errors." It's going to be one error page which displays some basic apologies and whatnot and tells the user what specific error we encountered. It's much nicer than having to make one for each error. – Justin Folvarcik Dec 07 '13 at 22:08
  • then use PHP . Most of the famous frmeworks in php are used php for handling error request in one page similar to yours – Sanjog Kumar Dash Dec 07 '13 at 22:13
0

Perhaps something like this? Also found something similar here. And also here. Seems like the same basic idea in all examples. You make the .htaccess file and then use $_SERVER['REDIRECT_STATUS']; to detect the error code.

cen
  • 2,873
  • 3
  • 31
  • 56