Microsoft KB Archive/941329

= How to point to a custom 404 error Web page in Windows SharePoint Services 3.0 or in Microsoft Office SharePoint Server 2007 =

Article ID: 941329

Article Last Modified on 9/5/2007

-

APPLIES TO


 * Microsoft Office SharePoint Server 2007
 * Microsoft Windows SharePoint Services 3.0

-



INTRODUCTION
This article describes how to point to a custom 404 error Web page in Windows SharePoint Services 3.0 or in Microsoft Office SharePoint Server 2007.



MORE INFORMATION
To configure Windows SharePoint Services 3.0 or SharePoint Server 2007 to point to a custom 404 error Web page, follow these steps:  Log on to the computer that is running SharePoint Server 2007 by using an account that has administrative permissions. In Windows Explorer, locate the following folder:

\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\TEMPLATE\LAYOUTS\

Notes  In this path,  represents the actual drive name of the drive on which the operating system is installed. In this path,  represents the actual language ID of the language that you use. For example, 1033 is the language ID for U.S. English.   Create the custom HTML file. To do this, use the appropriate method.

Microsoft Office SharePoint Server 2007
 On the computer that is running SharePoint Server 2007, copy the Sps404.html file to a temporary folder.</li> Rename the Sps404.html file. For example, give the file the following name:

Custom404.html

</li> Add the custom content to the Custom404.html file.</li> Copy the Custom404.html file to the \Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\TEMPLATE\LAYOUTS\  folder.</li></ol>

Windows SharePoint Services 3.0
<ol> On the computer that is running Windows SharePoint Services 3.0, locate the existing Error.htm file in the following folder:

\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\TEMPLATE\LAYOUTS\

Notes  In this path,  represents the actual drive name of the drive on which the operating system is installed.</li> In this path,  represents the actual language ID of the language that you use. For example, 1033 is the language ID for U.S. English.</li></ul> </li> Copy the Error.htm file to a temporary folder.</li> Rename the Error.htm file. For example, give the file the following name:

Custom404.htm

</li> Modify the Custom404.htm file as required.</li> Copy the Custom404.htm file to the \Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\TEMPLATE\LAYOUTS\  folder.</li></ol> </li>  Create a custom console application by using Microsoft Visual Studio 2005 Professional Edition or Microsoft Visual Studio 2005 Standard Edition. Then, add the following code to the custom console application. // The following code assumes that a reference is made to Microsoft.SharePoint.

Microsoft.SharePoint.Administration.SPWebApplication webapp = Microsoft.SharePoint.Administration.SPWebApplication.Lookup(new Uri(&quot;http:// &quot;)); webapp.FileNotFoundPage = &quot;<Custom404.htm>&quot;; webapp.Update; Notes  In this code,  represents the actual URL of the computer that is running SharePoint Server 2007.</li> In this code,  represents the actual name that you created for the custom HTML file.</li></ul>

For more information about how to create a custom console application by using Visual Studio 2005, visit the following Microsoft Web site:

http://msdn2.microsoft.com/en-us/library/ms438026.aspx

Note By default in Windows SharePoint Services 3.0 and in SharePoint Server 2007, the FileNotFoundPage property is set to the &quot;null&quot; setting. </li> Run the custom console application on the computer that is running SharePoint Server 2007.</li></ol>

Note By default in Windows Internet Explorer, the Show friendly HTTP error messages setting is turned on. In this case, the custom error page may not appear. For more information about this setting, click the following article number to view the article in the Microsoft Knowledge Base:

218155 Description of Hypertext Transport Protocol Error Messages

Additional query words: SPS

Keywords: kbhowto kbexpertiseinter KB941329

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.