I know most sites typically create a custom 404 page. Are there any other custom error pages I should create? Or just watch my logs and see which ones are hit more frequently?

This is for a PHP web app, not a blog or static html site.

  • Not sure if this should be CW, feel free to change it if so.
    – BenV
    Aug 12, 2010 at 22:36

5 Answers 5


On my sites, I create error pages for errors that I think people may commonly run across. Other than 404, here are the ones I target:

  • 500: Internal Server Error - if your app fails, showing a generic 500 error page will only confuse users
  • 403/401: Forbidden/Unauthorized - I display a custom error page when a user tries to access something that they're not allowed to access.
  • 400: Bad Request - pretty self-explicable
  • 409: Conflict - if a user is blocked from some functionality by the throttling/rate-limiting, I tell them to try again
  • How often are you serving the bad request page?
    – delete
    Aug 13, 2010 at 2:00
  • @Kinopiko you're right, that's a tough one - I usually serve it when the URL parameters are somehow messed up. Aug 13, 2010 at 18:50

For most sites 404 and 500 are all you need. If your site has a member login then you could use a 401, but most times you want to redirect to a login page for this rather than displaying an "error".


We just have a 404. The big trick we did is that our 404 script looks for moved pages, and throws the moved status correctly.


It's difficult to give you a direct answer if you don't provide an example use case.

Here is a list with all Status Codes you can/should use for differrnt cases (redirected, removed, etc.). So you could search for your case, select the right code and if it is necessary create a costum error page.

Here are the examples who maybe needs a costum error page quoted from my apache.conf:

Customizable error responses come in three flavors: 1) plain text 2) local redirects 3) external redirects

Some examples:

  • One thing to keep in mind is that if you're listing the full URL of an error page in your Apache config files, that will result in a redirect to the error page and you will have to return the error code yourself. If you list the relative path, Apache will return your error page instead of the requested URL and automatically use the proper HTTP result code for you. Especially for things like 404 pages, you need to make sure that visitors (eg search engine crawlers) see the right HTTP result code. Aug 13, 2010 at 7:17

It's nice to keep redirects, authentication requirements, and other miscellaneous housekeeping in a single script for a variety of reasons.

I use a modified version of this PHP handler script for 404's and 301's - you will probably want to set up static 500-series pages (so your web server can return something useful in the event that the PHP parser is failing for whatever reason).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.