3

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)
  • any help on this !! – Milind Feb 8 '16 at 4:49
3
+50

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()
  • Will this work for SharePoint 2013. As I know SharePoint will not allow browse file outside SharePoint – Milind Feb 11 '16 at 9:10
  • Sorry, forgot to add a subfolder that would contain all error pages. Edited my answer. From SharePoint 2010, all physical folders set under the root of Web Site (in IIS meaning), not declared as "managed paths" (wilcard or explicit) in Sharepoint should be browsable as if they were not part of SharePoint. – Evariste Feb 11 '16 at 9:18
  • What do u mean by subfolder. Is it on my file system or on the SharePoint – Milind Feb 11 '16 at 9:20
  • I mean: create a physical subfolder under the physical path of your SharePoint Web Site, e.g. C:\inetpub\wwwroot\wss\VirtualDirectories\80\CustomErrorPages – Evariste Feb 11 '16 at 9:20
  • Cool let me try this and get back to you – Milind Feb 11 '16 at 9:21
0

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.