Ram Prasad Meenavalli
 
 

Custom Page Not Found Page for SharePoint 2010 site

Published on 12-Aug-2011 | Comments

Setting a custom Page Not Found page for a SharePoint 2010 site works the same way as we did for a SharePoint 2007 site in the previous article. Earlier we used to change the Page Not Found reference for a Web Application using SharePoint API. But in SharePoint 2010, we can do this easily using PowerShell.

Create the custom404.html file as described in the previous article, and put in the below location instead of the 12 hive.
\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\LAYOUTS\LangID
(1033 is the language ID for U.S. English)
Now run the following commands in a PowerShell window.

$webapp =Get-SPWebApplication http://<SiteUrl> $webapp.FileNotFoundPage = "custom404.html" $webapp.update()

The above code is self explanatory. We created a powershell variable which holds a reference to the WebApplication of your site. And using this variable, we can set the FileNotFoundPage property of the webApplication to the custom page's filename.
So, for a SharePoint 2010 site we can change the Page Not Found page reference without writing any console application or feature activation code.

Author

View Ram Prasad Meenavalli's LinkedIn profile

Ram Prasad MCITP,MCTS,MCPD
SharePoint Technology Evangelist

 

 

Comments