There is no OOTB way for this.
However, few customization options are as below:
Create Custom page and run powershell script
First create three pages and place them in this path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\TEMPLATE\LAYOUTS\1033\"
Second Open SharePoint 2013 Management Shell with Farm Administrator User
Now For Custom access deined page, run the following script:
$spWebApp.UpdateMappedPage([Microsoft.SharePoint.Administration.SPWebApplication+SPCustomPage]::AccessDenied, "/_layouts/MyPortal/error.aspx");
$spWebApp.Update();
Please note that UpdateMappedPage and Set-SPCustomLayoutsPage are not just for access denied. They are used for the following pages:
■AccessDenied
■Confirmation
■Error
■Login
■RequestAccess
■Signout
■WebDeleted
2.Create an HTTP handler (covered a bit in this forum post) to intercept each request and redirect to your custom page if the server is sending the user to the out of the box accessdenied.aspx page. I don’t like this since it adds overhead to every SharePoint page request.
3.Not a preferable option:
- Add a delegate control to the error.master like below. (I know, I know. Not ideal)
- Create a user control to be deployed to _controltemplates
- Create an elements.xml file which will add the control to the delegatecontrol.
- On the pageload method of the user control check the request url. If it is for access denied, redirect users to your custom page.
A nice option for those who are ok with modifying out of the box pages.