Create Custom 404 Page Not Found Error Page in SharePoint

Do you have a custom 404 error page that you would like to use for your SharePoint site? If not, then don’t worry! This blog post will show you how to create one in no time to improve your site’s usability. A custom 404 page can be beneficial when a user mistypes your site’s address or clicks on a broken link. You can use it to provide information about the problem and how to fix it or simply direct users back to where they were supposed to go. In this blog post, we will walk you through the steps of creating a custom 404 error page for SharePoint.

It’s a best practice to show a customized 404 page not found error page for any website when a user requests 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, It’s great to have a custom 404 Page not found error page in SharePoint 2010 to add some user experience, isn’t it? Let’s see how a 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 images 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 can 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 the 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

Salaudeen Rajack

Salaudeen Rajack is a SharePoint Architect with Two decades of SharePoint Experience. He loves sharing his knowledge and experiences with the SharePoint community, through his real-world articles!

6 thoughts on “Create Custom 404 Page Not Found Error Page in SharePoint

  • What about the site is a subsite of it?

    Reply
  • Really helpful thank you!

    Reply
  • Thanks, nice solution.

    Reply
  • Nice article. Really helpful but one thing is that where would i find web.config file?

    Reply
    • web.config file reside on the Root directory of your IIS Web Site’s Virtual Directory.

      Reply

Leave a Reply