Friday, June 1, 2012

Custom 404 Page Not Found Error Page in SharePoint 2010

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:
            <remove statusCode="404" subStatusCode="-1" />
            <error statusCode="404" prefixLanguageFilePath="" path="/SitePages/custom404.aspx" responseMode="ExecuteURL" />

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" />

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

There is an alternate method by setting custom 404 redirect page in SharePoint. Refer the KB Article:

You might also like:
SharePoint Usage Reports
Usage reports, collaboration and audit for SharePoint.
Document SharePoint Farm
Automatically generate SharePoint documentation.

Check out these SharePoint products:


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

    1. web.config file reside on the Root directory of your IIS Web Site's Virtual Directory.


Please Login and comment to get your questions answered!

You might also like:

Related Posts Plugin for WordPress, Blogger...