Articles on: cPanel Tutorial

How to Design Custom Error Pages in cPanel

Error pages inform visitors about problems when they attempt to access your site. Each problem has its own status code (for example, 404) and error page.

The web server automatically provides basic error pages, but the Error Pages interface allows you to define custom error pages for any HTTP status code.

Source: cPanel Documentation

Here's how you can design your own custom error pages:

Login to cPanel and click on Error Pages under Advanced section.



Click the drop down box under the Management menu and choose the domain you wish to select.



You will see a list of Common Error Codes, click the one you want to create a custom error page for. The available choices are 400 (Bad request) , 401 (Authorization required) , 403 (Forbidden) , 404 (Not found), and 500 (Internal server error). To edit additional error codes, click the Show All HTTP Error Status Codes tab. In my tests, I am selecting 404 (Not found)


You will then be on an editor page. You can enter HTML code here, or insert premade tags if you want. Below is a brief description of the available tags.




Here's my sample error 404 design (note: some basic HTML coding is involved):






Click the Save button at the bottom when you are finished.




Now, you need to create .htaccess file and add a rule for the errors you created. Below is an example of the file formatting for .htaccess file:
ErrorDocument 400 /400.shtml
ErrorDocument 401 /401.shtml
ErrorDocument 403 /403.shtml
ErrorDocument 404 /404.shtml
ErrorDocument 500 /500.shtml



NOTE: If you're using WordPress, make sure you remove all the content inside the default .htaccess file before inserting the code above.


Save your .htaccess file. Now when someone triggers an error message on your site, it will display your Custom Error Page. Here's how our cuistom error page appears for Error 404 Not Found.

Updated on: 18/01/2019

Was this article helpful?

Share your feedback

Cancel

Thank you!