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
to something like this
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
4. Open sp2010 management shell and run the following PowerShell commands (change <sitename> to your site URL)
$webapp =Get-SPWebApplication http://<sitename>
$webapp.FileNotFoundPage = "custom404.html"
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