Setting a custom error page from the cPanel or by manually editing the .htaccess file for the root domain will apply that error page for all domains on the account.
To create separate custom error pages for an addon or sub-domain, you will need to create a .htaccess file in the addon or sub-domain folder which contains an 'ErrorDocument' command. The format for the command is:
ErrorDocument *Replace With Error Code* http://domain/page
Be sure you replace *Error Code* with the specific error code you are referring to. For example, if you are creating a 404 page, you will need to replace *Replace With Error Code* with just 404.
For an addon or subdomain, the error page path must be a fully qualified URL. For example, instead of using a file name like 404.shtml, you must use http://www.example.com/404.shtml
Examples
If you have created a 404.shtml and uploaded it to the root directory of your domain, example.com, your .htaccess file must contain the following line before the new error document would successfully be used:
ErrorDocument 404 /404.shtml
You can use the ErrorDocument command to redirect page errors to a file name with an extension other than .shtml. If you wanted to use a 404.php script file you have written, it would look like this:
ErrorDocument 404 /404.php
If you would like people to be redirected to the homepage when they reach a non-existent page, you could use a line like this:
ErrorDocument 404 http://www.example.com/
A .htaccess file controls the directory in which it sits and all sub directories under it. However, by placing additional .htaccess files in the sub directories, other .htaccess files can be overruled.
There are many error pages which may be defined.
Client Request Errors
400 - Bad Request
401 - Authorization Required
403 - Forbidden
404 - Not Found
405 - Method Not Allowed
406 - Not Acceptable (encoding)
407 - Proxy Authentication Required
408 - Request Timed Out
409 - Conflicting Request
410 - Gone
411 - Content Length Required
412 - Precondition Failed
413 - Request Entity Too Long
414 - Request URI Too Long
415 - Unsupported Media Type
Server Errors
500 - Internal Server Error
501 - Not Implemented
502 - Bad Gateway
503 - Service Unavailable
504 - Gateway Timeout
505 - HTTP Version Not Supported
Rating:
9.1/10
Powered by WHMCompleteSolution
Print this Article
Home
Submit Ticket
Knowledgebase
Domain Checker
View Cart
Register
Hosting Login