SharePoint 2010 Custom Error Page using HTML
Steps to set the custom HTML error page for the SharePoint 2010
1. Prepare your HTML error message page/file and place it in the hive folder ( I'm using a sub folder here 14/CustomError) in the web front end server
2. Open the PowerShell in the administator mode and run the below command.(in all the web front end server)
Set-SPCustomLayoutsPage -Identity Error -RelativePath /_layouts/14/CustomError/error.html -WebApplication http://sharepointsitecollectionurl
For see the error (Enabling Error Details)
Web.Config >> Enable stack trace ( true) and custom error mode = Off
And this script will not run on the SharePoint 2013 as the error pages are given directly in the Site Collection pages library.
PS: The above code is tested in my development server and it runs perfect for SharePoint 2010 and its the risk of the users to run the code in their environment. So run at your own risk!
More on this http://technet.microsoft.com/en-us/library/ff607768.aspx