Pages

Thursday, January 12, 2012

How to create Custom 404 Error Page in SharePoint 2010

Hello Readers

It is very good practice to create Custom 404 Page  for SharePoint Web Application because users always love some custom and  meaningful text on pages rather than “this resource can not find please go back to site”.

So Let us see how to create custom 404 Page in SharePoint 2010.

Let us see step by step process for that
  1. Copy the original sps404.html located at Local Drive:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\LAYOUTS\1033 and rename that file  and give some useful and meaningful name like spsCustom404.html in the same directory.  
     2. Write this code in spsCustom404.html  file

     <html>
     <head>
       <meta HTTP-EQUIV="Content-Type" content="text/html; charset=utf-8" />
       <meta HTTP-EQUIV="Expires" content="0" />
       <noscript>
              <meta http-equiv="refresh" content="0; url=/_layouts/CustomError.aspx" />
       </noscript>
       <script language="javascript" src="/_layouts/1033/init.js"></script>
       <script language="javascript" src="/_layouts/1033/core.js"></script>
       <script language="javascript">
              var requestedUrl = escapeProperly(window.location.href);
              STSNavigate("/_layouts/CustomError.aspx");
       </script>
     </head>
     <body>
     </body>
     </html>


3         3. Create an aspx file named as customerror.aspx under Local Drive:\Program Files\Common   Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\LAYOUTS\

   4. Write the content you want to write for users in the aspx page. 

   5.   Now It is time for deployment so easy in SharePoint 2010. Write these command lines in Poweshell   Script
          $webapp =Get-SPWebApplication http://www.webapplicaion.url
          $webapp.FileNotFoundPage = "spsCustom404.html"
          $webapp.update()

 Enjoy!!!

Disha Shah

No comments:

Post a Comment