1) Browse to C:\inetpub\custerr\en-US on the Server.
2) Open the folder you want to edit and modify the
error pages for 401,403,404 and 500.
Bottom section of the page holds the error message. Top section of the page
holds the code for portal header.
3) Browse to
C:\inetpub\wwwroot\wss\VirtualDirectories\ and open the folder associated to
the Sharepoint site you would like to affect.
4) Edit the file web.config and
find the keyword customErrors. Replace the complete customErrors code
block with:
<customErrors defaultRedirect="404.htm" mode="On">
<error redirect="401.htm" statusCode="401" />
<error redirect="403.htm" statusCode="403" />
<error redirect="404.htm" statusCode="404" />
<error redirect="500.htm" statusCode="500" />
</customErrors>
5) Now find the keyword <system.webServer>. Inside
this block, place the following block code. (If the httpErrors block
already exists, replace it completely!)
<httpErrors errorMode="Custom" existingResponse="Auto">
</httpErrors>
6) Save web.config file.
7) Perform the step 4 and 6 in both the virtual
directories (internal and external) for the SharePoint site.
8) Run iisreset command if needed
9) Do step 1 to 8 on all the 3 servers (for staging
or production environments).