Search This Blog

Wednesday, November 18, 2015

Custom 404 Page Not Found Error Page in SharePoint 2013

Its a best practice to show customized 404 page not found error page for any website when user request for a broken URL or mistyped URLs. SharePoint has no exclusions. By default, SharePoint gives this 404 error screen to the user:
sharepoint page not found 404 error

So, Its great to have custom 404 Page not found error page in SharePoint 2010 to add some user experience, isn't it? Lets see how custom 404 error page in SharePoint can be done: 

1. Create an aspx page in Root site collection (say, "\SitePages\CustomError.aspx"). Add some descriptive image and text to it.

2. Go to IIS Manager, Backup the web.config file and proceed with the following steps.

3. Expand the desired web application, open the "Error Pages" feature.
custom 404 page for sharepoint
4. Double click on 404 status code
sharepoint custom 404
 This will open the "Edit Custom Error Page" configuration window.sharepoint custom 404 error
Change the option to: "Execute a URL on this site" and specify the URL as: /SitePages/custom404.aspx (The Error page we have created!). Click Ok and quit IIS. 
sharepoint custom 404 web.config

5. By now, If you open the web.config file, you could see the <httpErrors> section as:
<httpErrors>
    <remove statusCode="404" subStatusCode="-1" />
    <error statusCode="404" prefixLanguageFilePath="" path="/SitePages/custom404.aspx"
responseMode="ExecuteURL" />
</httpErrors>

Add these attributes to <httpErrors> node: errorMode="Custom" existingResponse="Auto" so, the modified code would be:
<httpErrors errorMode="Custom" existingResponse="Auto">
    <remove statusCode="404" subStatusCode="-1" />
    <error statusCode="404" prefixLanguageFilePath="" path="/SitePages/custom404.aspx"
responseMode="ExecuteURL" />
</httpErrors>

6. Save web.config and do IISReset if needed. In fact, we can just skip the IIS console and 
place the above code directly in web.config! That's all, we are done with SharePoint custom page not found.

Once done, you should be able to get our custom 404 page content when you hit broken/deleted /mistyped URLs.

custom 404 page for sharepoint 2010


Read more: http://www.sharepointdiary.com/search/label/web.config#ixzz3rrWH89dw

No comments:

Post a Comment