create custom error pages in cpanel

create custom error pages in cpanel

Today in this article we are going to look learn how to create custom error pages in cPanel. Error pages are the pages which you see whenever there is some error loading the page you requested. For example, the most common error pages that we see is the “404 Error” message page. Whenever we try to access a page which isn’t there, the website throws a “404 error”. Now most websites have fancy custom error pages for 404 error. For instance, Facebook has the below page

facebook custom error page

Such good looking error pages adds to the user experience which the viewers of your site have. A user is less likely to get irritated when he/she stumble across an error page if it is nice looking error page. Moving on to google, it also has an equally fancy yet minimalistic 404 Error page.

Check out the complete guide on cPanel Tutorial

google custom error page

Although 404 Error is the most common, it isn’t the only errors which are common. Below is the list of errors which can occur.

  1. 400 (Bad request)
  2. 401 (Authorization required)
  3. 402 (Payment required)
  4. 403 (Forbidden)
  5. 404 (Not found)
  6. 405 (Method not allowed)
  7. 406 (Not acceptable)
  8. 407 (Proxy authentication required)
  9. 408 (Request timeout)
  10. 409 (Conflict)
  11. 410 (Gone)
  12. 411 (Length required)
  13. 412 (Precondition failed)
  14. 413 (Request entity too large)
  15. 414 (Request URI too large)
  16. 415 (Unsupported media type)
  17. 416 (Request range not satisfiable)
  18. 417 (Expectation failed)
  19. 422 (Unprocessable entity)
  20. 423 (Locked)
  21. 424 (Failed dependency)
  22. 500 (Internal server error)
  23. 501 (Not Implemented)
  24. 502 (Bad gateway)
  25. 503 (Service unavailable)
  26. 504 (Gateway timeout)
  27. 505 (HTTP version not supported)
  28. 506 (Variant also negotiates)
  29. 507 (Insufficient storage)
  30. 510 (Not extended)

Now, obviously you don’t need error pages for each one of the above 30 error codes. Having said that, it is highly recommended to have custom error pages for at least the 5 most common error codes i.e.

  1. 400 (Bad request)
  2. 401 (Authorization required)
  3. 403 (Forbidden)
  4. 404 (Not found)
  5. 500 (Internal server error)

In this tutorial, we are going to create a custom error page for 404 (Not Found) error. You can create the custom error pages for other error codes in a similar way.

Steps To Create a Custom Error Page in cPanel

Step 1: Login to cPanel of your website.

Step 2: Go to the Advanced section and click on “Error Pages”.

create custom error pages in cpanel

Step 3: Now you will be navigated to “Error Pages” settings page. Here first of all select the domain whose error pages you wish to set from the dropdown. Once you have done that, you’ll see the list of most common error codes. Click on 404 (Not Found).

Step 4: Now to create a custom error page, we are actually going to create a 404.shtml file. The HTML inside this file will be displayed to the user when that error occurs. So enter the HTML content on this screen.

Step 5: You can show the user their referring URL, their IP address etc. by adding standard tags for it by click on one of below hyperlinks.

custom error

Step 6: Once you have finished creating the HTML page, click on the Save button.

Step 7: Now the only thing left is to attach the created error page to the actual error. For that, go back to cPanel and click on “File Manager” in “Files” section.

Step 8: Edit the .htaccess file. Add the following line to that file without quotes “ErrorDocument 404 /404.shtml”.

Step 9: Click on save and you are done.

Congratulations, you have successfully created a custom error page in cPanel. Also read our other cPanel Tutorials:

 

I hope you like this article and If you feel we have missed something then please let us know using the comment box below. Keep showing your love by sharing this post on your social media circle and join us on Facebook, Twitter andGoogle+ as well.

Sources:

3 COMMENTS

LEAVE A REPLY

Please enter your comment!
Please enter your name here

20 + 19 =