For one of our project we have request of handling 500 internal serer error page, client want to redirect page to other page similar to 404 redirect. Sitecore does not provide this feature internaly. Now it was a multi site solution and client don’t want to redirct all page to same location.
So we choose to update the web.config file where we have added following configration –
<httpErrors existingResponse=”Replace” defaultResponseMode=”ExecuteURL” errorMode=”Custom”>
<remove statusCode=”500″ />
<error statusCode=”500″ path=”/error/500″ responseMode=”ExecuteURL”/>
Where are using resoponse mode = execute URL which will execute the url of current site.
in above example, it will redirect http://hostname/error/500 for each website separately.
Now next thing was creating 500 page in each website, so we have follow the same url structure in sitecore as well. we have created a node under home with name “error” and then under it created a page item which was a generic page in our case with name “500”.
Content editor can show what ever he wants to show on this page and he/she can create same structure for all other websites as well.
Now what if there no path specified for 500 (“/error/500”) under home page in any website? Then it will show the 404 page not found error or will redirect to 404 custom page.