Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

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?

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

share|improve this question
    
Not sure if this should be CW, feel free to change it if so. –  BenV Aug 12 '10 at 22:36
add comment

5 Answers 5

up vote 3 down vote accepted

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
share|improve this answer
    
How often are you serving the bad request page? –  delete Aug 13 '10 at 2:00
    
@Kinopiko you're right, that's a tough one - I usually serve it when the URL parameters are somehow messed up. –  Maxim Zaslavsky Aug 13 '10 at 18:50
add comment

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:

share|improve this answer
    
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. –  John Mueller Aug 13 '10 at 7:17
add comment

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.

share|improve this answer
add comment

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).

share|improve this answer
add comment

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".

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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