Every web server can display HTTP error pages, but default error pages don't provide useful information to your visitors. Some error pages may even leak sensitive information about your site, such as URL or file paths, database details, and even code. But you can replace the defaults and create custom HTTP error pages that improve your visitors' experience and your site's security.
... and later:
To provide a better user experience, create fewer error pages, but ones that are more helpful and easier to understand. In production environments you can show one error page for all client-side problems (4** error codes). Such an error page should be based on the 404 Not Found error and explain that the requested resource is not found, and therefore visitors need not try to access it again. Having only one error page for client-side problems means visitors don't have to understand unfamiliar error codes. Seeing different error pages for specific client-side problems is useful mostly for development and QA environments.
Furthermore, from security point of view it's better not to show different error pages for client-side problems because doing so may disclose sensitive information. For example, a 403 Forbidden error page may hint to an attacker that the target resource is important.
You should also create one unified and generic page for the server-side errors (5** error codes) that says that the requested resource exists but is temporarily unavailable, so the user should revisit the page soon. As with client-side problems, you don't need to show publicly exactly what went wrong on a production server. Your visitors shouldn't care whether a reverse proxy died or the server is overloaded.
Handling 404 errors is important because the average site visitor is not aware what an HTTP 404 Error code means. Also, the default messages returned by webservers are too technical, poorly constructed and leave the visitors frustrated. Therein is the need to give your users something better and make your own custom 404 error page.
Here are some ideas you can use:
1. Cut the tech jargon
Users do not understand http error codes. They just need to be told that the page is not available any more while jargon may confuse them. If you wish to do so you can, but mentioning ’404’ is not necessary. Instead substitute that with a phrase such as “The page you requested does not exist any longer" – pick your own words but put it across subtly.
2. Avoid clutter
A user-friendly 404 error page should strike a balance between giving out too much and too little. You can showcase your entire site navigation on the page, but will it help? An overwhelming number of links will add to the predicament of the already lost user. So what kind of links should you have on your custom 404 page? Some steps to ensure a compact but yet effective look are listed below:
a. Present the most relevant links
Place links only to the most important pages, categories and products of your website. Also provide a link to your home page, most popular searches & recent articles. Do you have a blog? If yes, link to it.
b. Link to your sitemap
An easy way to direct users to a detailed site navigation without cluttering the 404 page itself.
c. Place a Search box
If the links you provide are not interesting to your users a Search box will help them find out what they are exactly looking for.
Essential Do’s & Do not’s
a) Return the right http status code
There is a possibility that your custom 404 page might get indexed by the crawlers and appear in the SERPs as well. To avoid this, ensure that your webserver returns a 404 HTTP status code when a non-existent page is requested. An HTTP 404 Error code will prevent your 404 page from being indexed by the crawlers.
b) Implement a 404 notification mechanism:
It is not the visitors’ job to notify you about broken links on your website. As a webmaster I strongly believe that it is your job to put an effective mechanism in place to identify and eliminate as many broken links on your site as possible. Google Webmasters is a good source to lookout for the origin of 404 errors as well as fix them. Another way could be scheduling automated email reports from server logs. Keeping a watch over the logs will alarm you if there is a sudden surge in the 404s. The key is to fix 404 errors yourself and not have the users fill out a broken link form for you.
c) Do not redirect to home page:
What happens if a user clicks on a broken link 2 minutes after browsing through your navigation and is taken to the home page rather than being displayed a customized 404 error page? The user would either find the way again to get to the link where he/she fell off, try a different link altogether or disengage and abandon the website with a possibility of never coming back again. None of these alternatives seem to be good for the user’s experience, do they? Hence, do not redirect users back to the homepage when they click on a broken link –always serve a customised 404 error message page.
The StumbleUpon 404 is a good example of what is written above. Have a look at it here.
There are plenty of creative, funny and unusual examples to gain ideas from as well as there are Google’s own guidelines to customize your 404 page but the basic factor to always keep in mind is that you should make your page useful for its visitors.