0

I would like to have pretty 404 pages, as well as other error pages.

I redirected all the errors (400, 401, 403, 404, 500, 502, 504) to my error.php.

Apache provides a lot of information in $_SERVER variable.

Do you know if there is good a ready script I can use for my error pages?

Alex L
  • 8,419
  • 6
  • 43
  • 51
  • Pretty is not the right word for this. I meant that I want proper output depending on the error code. This should be done dynamically by my php script. – Alex L Jul 13 '09 at 22:36
  • To clarify, I was looking for a script that has a message for each http error code. If $_SERVER[REDIRECT_STATUS] is 403, say Sorry but you are not allowed here. If $_SERVER[REDIRECT_STATUS] is 404, say Sorry page not found etc. – Alex L Jul 14 '09 at 04:14

2 Answers2

2

I think the only important information you need is REDIRECT_STATUS and REQUEST_URI.

Gumbo
  • 643,351
  • 109
  • 780
  • 844
0

Do you have access to your apache config? If so, just specify custom files (404.html, 500.html, etc.) and populate them with appropriate HTML and CSS to make them as 'pretty' as you like. Or is there more of a problem here?

Bobby Jack
  • 15,689
  • 15
  • 65
  • 97
  • I would like to have a script that process the errors dynamically. – Alex L Jul 13 '09 at 22:34
  • 1
    Can you give a little more information? For example, what do you want to do differently in, for example, the event of a 404 as opposed to a 500, that isn't just a static page? You should be careful doing anything too processor-heavy as the result of an error page, since your server could easily be handling quite a few 404's (as the result of badly behaved robots). – Bobby Jack Jul 13 '09 at 22:54