It is important to return HTTP 404 when there is no content at the URL, redirecting to another URL is evil

I got depressed when I look for a wordpress plugin which will let me control what is display on my site’s 404 page, as too many plugins suggest to redirect to another page automatically or based on some manual configuration.

This is so wrong, 404 (and all of the 4.xx codes) indicates a client error, and you should not pretend that there was no error otherwise the client will never learn and improve.

It is not only about following the letter of the standard, there areĀ  practical implications to not following it:

  • A person that bookmarked (maybe the URL was copied from mail or configured in a smartphone) will get to an unexpected content without getting any indication whether it was his fault (used wrong URL) or the content had disappeared from the site.
  • Owners of sites that link to your content (an HTML link or reference to a img,video or other resource on your site) will never get an indication from link checkers that their links are bad and will never fix it to point to the right content.
    The worst scenario is that you, or someone affiliated with you, owning that site, and it might even be a bad kink on the same site.
  • If you use javascript based analytics software (like google analytics) they will fail to report 404 pages as the scripts will never be loaded for them
  • It effectively creates several valid URL for leading to the same content which might be good or not depending on the content in the source of the URLs and the latest google ranking algorithm

Yes, 404 pages should be more then some pretty and amusing page, but whatever it displays to the user, it has to keep sending the content with a 404 code.

Leave a Reply

Your email address will not be published. Required fields are marked *