How to create a 404 or Custom Error Page in SharePoint 2010

404 Error page is a standard to display a page with your own message if user mistype a page name. To configure custom error page eg HTTP 404 Page not found error in SharePoint 2010. It is a good practice to create custom error page. To do so just follow below steps:

1. Go to _layouts/1033 folder and find SPS404.html.
2. Copy this SPS404.html and paste it at same location.
3. Rename this new file for eg : SPSCustom404.html.
4. Edit SPSCustom404.html file in any text editor.
5.Search for  STSNavigate("/Pages/Pagenotfound.aspx?oldUrl=" + requestedUrl);
6. /Pages/Pagenotfound.aspx is the page location which you want to display in case of HTTP 404 error occurs.
7. Once you done with editing, save and close this file.
8. Open SharePoint 2010 Powershell.
9. Run below command
$WebApp = Get-SPWebApplication "siteurl"
$WebApp.FileNotFoundPage = "SPSCustom404.html"
$WebApp.Update()

Now you are done, just type a wrong page name with your webapp url and see the result.
If this is useful for you, do not forget to like us on facebook.

Comments

Popular