When a visitor reaches a page on your website that doesn’t exist, by 
default they get a nasty, ugly document, that very well may end any 
future interaction with your company.
It is extremely important to create a custom 404 error document for 
your website. More than any other error page, you must customize your 
404 error page to hopefully route those lost visitors back to your 
mainland.
404 error’s are for the most part unavoidable. I have never seen a website that doesn’t serve a 404 error every once in a while. Whether you mistyped a link, the visitors misspelled a page in their address bar, or anything else, at some point your server will send a 404 error.
What your 404 page must contain:
- An Apology for delivering the wrong page.
 - Something that lets them know they are on the right website.
 - A search box for your website.
 - A link to your sitemap.
 - A link to your homepage.
 - The proper error 404 headers.
 
Apologize for delivering the wrong page. – Lets face
 it, whether your visitor typed the wrong address in the bar, or you 
made a broken link on your website, it’s still your fault for not 
showing your visitor what they were looking for. Although possibly 
humorous, proclaiming that your visitor has the intelligence of a piece 
of chalk, or ridiculing them for not knowing the difference between an O
 and a 0 is not a good way to keep their business.
Let them know they are on the right website. – 
Whoever gets to the dreaded 404 page needs to know quickly that they are
 at on the correct domain. A logo, your company name, both… Whatever the
 case, you need to make sure you visitor knows they are on the right 
website.
Include a search box for your website. – Obviously 
your visitor is on the wrong page. What better way to help them get back
 on track than letting them search for what they were trying to find in 
the first place. If you don’t have a search function on your website, 
Google has a free one that you can customize for your site, and there are a number of free and paid search engines in every possible language that you can integrate into your website.
Link to your sitemap. – Maybe your visitor doesn’t want to search, and they would rather look at a list of pages on your website. Your sitemap (assuming that it is well formatted)
 would be the best place for them to look. If your sitemap is going to 
cause more confusion than a blank page, you should probably work on 
making it more user friendly, and then put it on your 404 error page.
A link to your homepage. – It is completely possible
 that your visitor was just trying to get to the homepage. The home page
 is normally the most visited page on an entire website. Use at least a 
link that tells them it will send them to the homepage. If you put a 
logo on your 404 error page, then link the logo to the homepage as well.
The proper error 404 headers. – This one is not so 
much necessary for humans as it is for search engines and your server’s 
analytic software. Make sure that your server sends complete 404 Error headers
 when it is delivered to a user. If it is not configured properly, it 
will send a status code of 200 which means that everything is OK. 2,000 
indexed error pages isn’t going to help your site’s SEO campaign, and if
 you use log analyzing software, the results are going to be very 
incorrect. Here’s a good tool to check your error page’s header code. Just enter a page on your website that doesn’t exist and make sure you get a 404 error.
There are a lot of guides to this topic, and I think that a few 
things that many of those guides do wrong, is recommending to put too 
much information on your 404 error page. This page is not meant to 
replace a homepage, and should not be considered a central hub for 
information. You want to be clear that your visitor is not where they 
are supposed to be, and quickly give them a few options to get on track.
 You don’t want your visitors bookmarking 404 pages nor do you want them
 to send the broken page to their friends. Let them know who you are, 
that they’re in the wrong place, a few options to get back on track, and
 then stop!

