How to Create Custom Error Pages in cPanel

When a visitor to your site receives an error message, such as 404 (Not found), or 500 (Internal server error); they will see the default error page. You can easily customize these pages in your cPanel with the Error Pages button. For example, you may want to personalize the error message. In this tutorial, we will show you how to create a custom error page in cPanel. Then, we will show you how to add a .htaccess rule, so your custom error pages will load when needed.

Creating a Custom Error Page

  1. Login to your cPanel.
  2. Click the Error Pages button, in the Advanced section of cPanel.
    Accessing Error Pages in cPanel
  3. If you have multiple domains in your cPanel, select it from the Managing menu.
    cPanel Domain Error Pages
  4. 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)
  5. 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.
    TagDescription
    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 visitor’s browser type.
    Redirect Status CodeThis will display the error message code, such as 500, or 404, etc.
  6. Click the Save button at the bottom when you are finished.

Setup Your .htaccess File

  1. Edit the .htaccess file for your site, and add a rule for the errors you created. If you need help locating your .htaccess file, see our guide “Where is my .htaccess file?.” 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
  2. Save your .htaccess file. Now when someone triggers an error message on your site, it will display your Custom Error Page.

    Error Page Example

Congratulations, now you know how to create custom Error Pages in cPanel! For additional reading, here is a link to the official cPanel documentation on Error Pages.

JB
John-Paul Briones Content Writer II

John-Paul is an Electronics Engineer that spent most of his career in IT. He has been a Technical Writer for InMotion since 2013.

More Articles by John-Paul

7 thoughts on “How to Create Custom Error Pages in cPanel

  1. Please how can I redirect my 404 error pages to my homepage via Cpanel (

    404.shtml (Not found) precisely?

    1. Once you have the path for you 404 page set, you can go into the redirects section of cPanel and then redirect the page.

    1. Hello Bhupender,

      If you are working in the editor for the custom 404 error, just simply make it blank to revert it back to the default. The file that is saved is 404.shtml. If it’s blank then the default message is used.

      If you have any further questions or comments, please let us know.

      Regards,
      Arnel C.

  2. I have a custom error page I created in php named 404.php

    I used “ErrorDocument 404 https://nativedge.com/404” to direct all non-existent page to my error page and it seems to be working perfectly.

    The only problem I have is that google is showing that it is not returning the appropriate 404 response code. How can I fix it?

    1. Hello Muhammad Attahiru Jibrin,

      Try changing your file name and following the format shown in the tutorial above. I think your 404 is not working properly because of how you have set it up in .htaccesss. It appears to be acting more like a re-direct. Here’s another couple of resources about creating custom 404s:

      Creating Custom 404 pages – HTML Goodies

      Google – 404 pages

      I hope this helps to answer your question, please let us know if you require any further assistance.

      Regards,
      Arnel C.

Was this article helpful? Join the conversation!