Create a custom Page Not Found page on SharePoint 2010


I’m sure all your SharePoint sites are far too great to have any internal broken links 😉

But there may be a situation when someone incorrectly links to your SharePoint site and you want to give a custom error page to provide a ‘nicer’  404 failure page and provide an opportunity for the user to seek more help or to be able to navigate elsewhere on your site.

go from this

page not found

to something like this

custom page not found

Here is how you do it

1. Create your custom ‘page not found’ page and approve it.  You probably  also want to remove it from any navigation and exclude it from search results.  I created my custom error page in the pages directory of the root site.

2. go to ..\14\TEMPLATE\LAYOUTS\1033 and take a copy of sps404.html and rename the copy to custom404.html

3. edit the file so that stsnavigate line points to the page you created in step 1

STSNavigate("/Pages/PageNotFound.aspx");

4. Open sp2010 management shell and run the following PowerShell commands (change <sitename> to your site URL)

$webapp =Get-SPWebApplication http://<sitename&gt;
$webapp.FileNotFoundPage = "custom404.html"
$webapp.update()

To redirect to a custom error page for other http errors see my other blog on How to Create a Custom Error Page on SharePoint


references 

http://support.microsoft.com/kb/941329

Advertisements

About SharePoint Surfer

A SharePoint professional working in local council, experiencing the pointy end of SharePoint.

Posted on February 9, 2012, in PowerShell, SharePoint and tagged , . Bookmark the permalink. 1 Comment.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: