Question

I have SharePoint 2013 Enterprise on Windows 2012. Configure as website. I have also configure Page Not found (error 404) on my SharePoint.

Now Situation is that when there is error as below on SharePoint, due to that website is down, I was looking to make Temporary page on my server outside SharePoint and want to display that page whenever below error.

Kindly can somebody guide me how can we do that.

  • 400 Error (bad request)
  • 401 Error (unauthorized)
  • 403 Error (forbidden)
  • 500 Error (internal server error)
Was it helpful?

Solution

If you want to redirect to static HTML pages (hosted in a folder at the root of the Web Site in IIS), the following modifications in the web.config (under <configuration>/<system.webServer>) should do the trick for 404 an 500 errors:

<httpErrors errorMode="Custom" existingResponse="Replace">
  <remove statusCode="404" />
  <error statusCode="404" path="http://sharepoint2013/Error/404.html" responseMode="Redirect" />
  <remove statusCode="500" />
  <error statusCode="500" path="http://sharepoint2013/Error/500.html" responseMode="Redirect" />
</httpErrors>

Also: be sure the "Test" folder is set for Anonymous access (to be done from IIS console). As you can see, the redirection uses an absolute path, so it can be to another server.

For access denied error, you can customize it with SharePoint PowerShell commands:

$webApp = Get-SPWebApplication http://sharepoint2013
$webApp.UpdateMappedPage([Microsoft.SharePoint.Administration.SPWebApplication+SPCustomPage]::AccessDenied,"_layouts/15/Error/AccessDenied.html") 
$webApp.Update() 

Notes:

  • The file "Error/AccessDenied.html" has to be under "_layouts/15" (i.e. C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\template\layouts) on all servers in the farm. The only recommended way to achieve this is to provision this file with a WSP package.
  • The PowerShell commands cold be issued as C# from a feature event receiver (scoped at Web application). That feature would be embeded in the same WSP.
  • To revert back to default configuration, use:
    $webApp = Get-SPWebApplication http://sharepoint2013 $webApp.UpdateMappedPage([Microsoft.SharePoint.Administration.SPWebApplication+SPCustomPage]::AccessDenied,$null) $webApp.Update()

OTHER TIPS

Errors "below" SharePoint should be handled in IIS. Use IIS HTTP-Errors to configure them. As @Evariste suggested, you'll have to add them to web.config - keep in mind that you'll need to modfy the web.config on all WebFrontend-Servers in your Farm. I'd suggest using a SPWebConfigModification.

Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top