1. Home
  2. Web Panels
  3. WHM/cPanel
  4. How to Create Custom Error Pages in cPanel

How to Create Custom Error Pages in cPanel

How to Create Custom Error Pages in cPanel
How to Create Custom Error Pages in cPanel

When a visitor reaches your site and receives an error message like 404 (Not found) or 500 (internal server error), they will usually be shown the default error page.
You may customize these error pages in cPanel using the ‘Error Pages’ button if you wish. For example: You might want to personalize their error message.
In the following tutorial we will teach you how to create a custom error page in cPanel. Then, we will teach you to add a ‘.htaccess’ rule so that the custom error page loads when required.

Creating a Custom Error page

Step 1: Log in to cPanel.

Step 2: Next, click on the ‘Error pages’ button in the ‘Advanced’ part of cPanel.

Step 3: In the case that you have several domains in your cPanel, simply choose the one you want through the ‘Managing’ menu.

Step 4: You should see a list of Common Error Codes, click on the one you would like to create a custom error page for.
Your choices should involve the following:
400 (Bad Request)
401 (Authorization required)
403 (Forbidden)
404 (Not found)
505 (internal server error)
Step 5: In order to modify additional error codes, click on the ‘Show All HTTP Error Status Codes’ tab. In this example, we are choosing ‘404 (Not found)’.
Step 6: Now you should be on an editor page. HTML code can be added here or insert premade tags if you would like.
Below is a short description of the tags you can use.

Referring URLLists the URL you came from.
Visitor’s IP addressLists the IP address of your site visitor.
Requested URLShows the URL you are attempting to access
Server NameShows the name of the server.
Visitor’s BrowserLists the the visitor’s browser type.
Redirect Status CodeThis will display the error message code, such as 500, or 404, etc.

Step 7: After you are done, click on the ‘Save’ button at the bottom once you have finished.

Setting up your .htaccess File

Modify the ‘.htaccess’ file for your site, then put a rule for the errors you have made.

Below is an example of the file formatting.
ErrorDocument 400 /400.shtml
 ErrorDocument 401 /401.shtml
 ErrorDocument 403 /403.shtml
 ErrorDocument 404 /404.shtml
 ErrorDocument 500 /500.shtml

Save the ‘.htaccess’ file. After which, when the error message on your site is triggered, it should show the following error page.

You should now know how to create custom error pages in cPanel.

Updated on December 23, 2018

Was this article helpful?

Related Articles

Leave a Comment

[apsl-login-lite login_text='Please login with a social account']