I was under the impression that 404 redirects to the front page is considered bad. all websites should have a 404 page. But at the same time I notice alot of people in forums that want their site to redirect to front page when a 404 is called. which is better. Having a 404 error page or redirecting to the front page
My Personal opinion is have a Detailed 404 error page which also has link to the Home Page. This way the user knows that he tried to access the page which does not exist.
Redirecting to home page without any notification sounds rude ;-)
The best is a custom 404 page, totally integrated into your design / site, with perhaps some hints parsed from the url which pages might be of interest, and at least a searchform. And do let it provide a 404-header. For some reason, a lot of peope don't get that while sending a 404 you can still sent a fully fledged webpage.
This is going to be a little subjective, I'd think, but here's my opinion.
A 404 Error serves a purpose: to tell the user that the page was not found. Redirecting to the front page suggests that's where the link was supposed to go.
As a user, if I hit a 404, I know the page is missing. If its a site in which I have a vested interest (say, my bank's self-service web portal, or SO, or some such) I can let someone know there's a problem.
If, instead, I'm re-directed to the main page, I tend to assume that's done on purpose and that the page isn't meant to exist, or someone already knows about the problem.
You can do both:
Show an error page with HTTP status 404 for search engines, and have the user redirected to the front page. For the redirection, use meta refresh or javascript.
But consider:
People coming from other domains (e.g. search engine, forums, blogs) are probably looking for a specific information, and your frontpage is most likely not what they're looking for. If you can't direct them to the information they're looking for, it's better to show them the 404 page than leave them wondering where the information is that was supposed to be there.
Minimize the 404 errors. If some resource doesn't exist anymore, use 410 Gone
. A properly designed site doesn't need to take out of commission URLs. If due to errors in the past you need to, set up a redirect to the new location.
Now the only 404s that should be left are mistakes entering direct address and bad links from outside (and possibly removed resources that can't know/don't want to reveal they existed). Sending a 404 error page is better than a 30x with redirect to the homepage because:
- It's more robot friendly. The spiders won't cache the resource thinking it's still valid.
- You can still include a link to the homepage in the 404 error page (in fact, you should).
Definitely have a 404 page that also sends a 404 header.
It tells bots when URLs are outdated
It saves you from problems with duplicate content (that search engines frown upon)
It shows users when their URLs are outdated or they typed something wrongly
people want to "keep" incoming visitors by redirecting them to the front page. I'd say this creates more annoyance than good, because it doesn't give incoming users a clue about the resource they were looking for. A good 404 page, possibly with intelligent links ("were you looking for...?") and a site map, is the best option.
If you moved stuff, redirect to the new page
You want to use 404 pages sparingly, if you are moving content around, you should try and put in a redirect utility that gets the user to the correct page. You might want to put a little notice up on that page if they get redirected to update their bookmarks. However you should only do this if the client in an actual browser, not some AJAX or GUI application.
Add SEARCH capabilities to your 404 page
Another thing you should do on a 404 page is to provide search capabilities right on the page. If a user ends up on the 404 page, it is typically because they are trying to find something - so make that easier for them.
For AJAX or programmed clients (i.e. GUI program uses your service): return a 404 or 410