By default, SharePoint returns the 404 error which is "file not found" error returned by the IIS Server to the browser.
The error message displayed might not be useful to the end user, requirement comes when one wants to provide some meaningful error message to the end user, this can be done very easily in SharePoint
Steps required to do so:
1) Under folder %systemdrive% \Program Files\Common Files\Microsoft Shared\Web ServerExtensions\14\TEMPLATE\LAYOUTS\<LangID>,
Note : <LangID> represent the actual language ID that you use.
create custom HTML file under the folder path, that will be seen by the user when the 404 error received by the user.
2) Then run the following power shell command.
$webapp =Get-SPWebApplication <Web application URL>
$webapp.FileNotFoundPage = "<Error page name>.html"
Verify that, if property is set
(Get-SPWebApplication <Web application URL>).FileNotFoundPage