Custom Error Pages

Custom Error Pages

If you want your web site to serve custom pages in case of any error then you will need to create a custom error page and make the necessary changes to your site so that the custom error page is displayed.

The error pages are displayed when the errors in the client’s request error or there are any server error. For example, a 400 error means the request is a bad request. The following are the types of error which leads to display of error pages:

Client Request Errors

Error Code                                     Reason
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

Error Code                                     Reason
500 –                                        Internal Server Error
501 –                                        Not Implemented
502 –                                        Bad Gateway
503 –                                        Service Unavailable
504 –                                        Gateway Timeout
505 –                                        HTTP Version Not Supported

To display the custom error pages, you will need to first create a custom error page using HTML or SHTML. If you don’t want to create error page in HTML or SHTML then you can also use Sitebuilder (Sitebuilder comes with Hostgator Hosting account) or any other web site builder. To display the error page, you will first need to login to Cpanel account and click on the Error Pages option. In the error pages option, you will need to click on the Advanced option and  then choose the domain on which you want to use error pages and click on the page on which you want to display custom error pages. Lastly, you will need to paste  your own custom page code (in HTML or SHTML). Click on the save and the changes will then apply. For the Page created using the Sitebuilder, the procedure is little different. In sitebuilder, you will first need to create the error page and then publish it and then you will need to visit the published page on your browser. From the browser then you will need to choose the click on the Source or Page source option and copy everything from the pop up window which appears. Now, you will have to paste the codes in the same way. Now, you can safely delete the page which you have published through Sitebuilder.

Custom Error Page example