Page not found error in SharePoint 2013

In SharePoint 2010, if users try to reach a non-existent resource e.g. a publishing page, web server returns a "404 Not Found" error.

If we consider the suggestions for creation of useful 404 pages as suggested by Google, almost all of them are not applied in default SharePoint 2010 'page not found' error page except that web server returns 404 NOT FOUND status code when a missing page is requested.

The default 'page not found' error page doesn't have the same look and feel as the rest of site. It is neither helpful nor a user friendly one. This is all very well explained by Waldek Mastykarz in his helpful SharePoint 2010 'Page not found (404)' page the way it should be post.

SharePoint 2010 Page Not Found Error Page

Waldek suggested the use of a custom HTTP Module that intercepts all 404 responses and redirects to a custom 'page not found' page instead.

How is this different in SharePoint 2013?

SharePoint 2013 introduced Custom HTTP 404 Error Pages. This allows creation of a new 404 Error page and set it as default for a site collection.

That sounds good and indeed this allows customization of page look and feel and add some helpful links or site's home page but again, it comes with its own problems.

  • The original URL is being replaced with the URL of the error page and the original URL is appended to 404 error page URL as a query string value.

SharePoint 2013 Page Not Found URL

  • The response status code for the 404 error page is 200 OK. That's a serious problem. There is a need for 404 Not Found status code in order to prevent 404 pages from being indexed by search engines.

SharePoint 2013 Page Not Found Status Code

  • The HTTP referrer that identifies the address of the page that being requested is totally missed out at server side in PageNotFoundError.aspx (default auto-created 404 error page that resides in the Pages Library). This is because server response actually starts a new request for the PageNotFoundError.aspx page and this is happening because of the call to window.location.replace as part of the server response with the URL to 404 error page. Not only this, window.location.replace won't enable user to to use the back button to navigate back to the requested page.

alt

Having said that, I'm still rooting for Waldek's solution for a proper SharePoint 2013 404 page.

You can discuss more on Reddit here.

Show Comments