SharePoint 2013 Hosting :: HTTP 404 (Page Not Found) Error Pages in SharePoint 2013

In this post we will take a deep look how to create a new 404 page and set it as default for a site collection.

Default PageNotfound\404 page – By default, all the Publishing sites contain a default Error\404 page “PageNotFoundError.aspx” page which is added to the “Pages” library (See below).

This page can be modified to add some custom text.

“Error Page” Content Type – To allow users to Create a new 404 Error page, Publishing Sites now contain a new Content Type “Error Page“.This Content type Inherits from “Page” Content type and has a typical layout of a Page Not found or 404 pages. To find this Content type Navigate to Site Settings -> Content Types -> Error Page.

Create a New PageNotFound or 404 Page – To Create a new 404 page admins can navigate to the “Pages” Library and under the “Files tab” select “New Document”.In the “New Document” drop-down menu select “Error Page” (see the screen below).

Once you have Created a new Error Page you can modify it by simply clicking the page in the pages library and editing it.

Once done Check In and Publish the page.

Set Custom Error\404 Page as default – Unfortunately, there is no straight way to set a new Custom Error Page as default (not that I know of..) but I guess with the Introduction of this new Feature, a new property “FileNotFoundUrl” has been added to SPsite object (which represents a Site Collection). As per MSDN description “SPSite.FileNotFoundUrl property” specifies Server relative or absolute URL to the file not found page. You can set this property for your Site Collection using the Object model to set your Custom page as default PageNotFound or 404 page.

Anyway, this feature will be a great addition to both Intranet or Extranet SharePoint sites.