Custom Error Pages
From Lunarpages Web Hosting Wiki
You can design and create your own error pages on your hosting account from cPanel. Using the built in tools, you can do all of this right from the control panel interface. This is just one more perk for those web hosting customers that have access to cPanel for their hosting account.
How to Create Custom Error Pages in cPanel
To get started, you need to login to your cPanel account. Once you have made it to the front page, scroll down to the Advanced section and click the icon for Error pages.
With this tool you can create custom error pages to display when a user enters a wrong URL, an outdated URL or when the user is not authorized to access a specific directory of your web space. You can setup a custom error web page for:
- 400 (Bad request)
- 401 (Authorization required)
- 403 (Forbidden)
- 404 (Wrong page)
- 500 (Internal server error)
As an example, let us say you click on the 404 link to create a custom 400 error web page. You can use these steps to help you create any of the above error pages.
You want to enter your web site code into the big empty text box. It can be HTML to help match the look of your web site. You can also enter any of the variables given below the text box too. They will dynamically display the information based on the details of the visit. They are:
- Referring URL
- Visitor's IP Address
- Requested URL
- Server Name
- User's Browser
- Status Code
When you are done, save the document and you are done. It is recommended to leave the file name as it is, but you can change it if necessary.
Please Note: For subdomains and addon domains, select them from the drop-down menu at the top of the page.
Manually Create Custom Error Pages
Ever check out some of those customized error pages and wonder how it could be done? The process if fairly easy and the magic can be worked with just a little editing to your .htaccess file. As an example, here is the code that would need to be copied and pasted into your .htaccess file to get this customized error page effect:
ErrorDocument 400 /errors/400.html ErrorDocument 401 /errors/401.html ErrorDocument 403 /errors/403.html ErrorDocument 404 /errors/404.html ErrorDocument 500 /errors/500.html
This tells the server to look inside the “errors” folder and that specific page for each of the different error types.
That is not all of the error codes, but they are the ones that will be ‘hit by your users 99 percent of the time. Now instead of being taken to the default error page for the server - you can have your own customized error page for your clients to see when something goes wrong.