I want to create the custom error page for site.
You can choose any of the 3 options from below.
Option 1: Replace the default
PageNotFoundError.aspx in the Page Library – One of the easiest and Convenient way to replace default text in
PageNotFoundError.aspx is to either edit the
PageNotFoundError.aspx that resides in the Page Library or to delete it and replace it with a Custom error Page that has the same i.e. PageNotFoundError page name.
If you choose to do this –
a) You would loose the default Created Page
b) You cannot replace the
PageNotFoundError.aspx with a Custom Error Page that you have deployed in 15 hive.
Option 2: Using
SPSite.FileNotFoundUrl property – You can use the Out-of-Box
SPSite.FileNotFoundUrl property of a Site to Change the URL of default Page Not Found page that is used for the entire site.
You can use the following PowerShell Commands to do this –
$spsite = Get-SPSite "Web App URL" $spsite.FileNotFoundUrl = "URL of the Custom Error Page"
Option 3: Using SharePoint Designer 2013 (set
vti_filenotfoundpage property) – With the new Site Options in
SharePoint Designer 2013, you can assign the
vti_filenotfoundpage property of the site to a Custom Error Page that you might have deployed in the 15 Hive.
Open your Site in Designer -> Under Manage section -> click on
Site Options -> In Parameters(tab) modify
vti_filenotfoundpage property to add a relative URL to your Custom error Page deployed in 15 Hive.
Refer below screen shot –
Refer Replace default PageNotFoundError.aspx with Custom Error Page in SharePoint 2013 for more details.