Home > Help Center > Shared Hosting > Website > Customize Error Pages in cPanel

Customize Error Pages in cPanel

What are Error Pages?

Error pages are web pages shown to the website visitor when something has gone wrong either with the web page they have requested or with the server's response.

When accessing a web server or application, every HTTP request that is received by a server is responded to with an HTTP status code. Each HTTP error has its own status code (for example, 404) and very basic error page:

cpanel error pages

What are Custom Error Pages?

One of the features of a professionally built site is to offer customized error pages instead of displaying the default not-styled and useless error pages to visitors.

Custom error pages are pages shown to your website visitors which match your website theme and provide visitors with useful information when an error has occurred within your website.

Error Messages

Good error message should include:

  • Explicit indication that something has gone wrong. The very worst error messages are those that don't exist.
  • Human-readable language, instead of obscure codes or abbreviations such as "an error of type 2 has occurred."
  • Polite phrasing that doesn't blame users or imply that they are either stupid or doing something wrong, as in "illegal command."
  • Precise description rather than vague generalities such as "syntax error."
  • Constructive advice on how to fix the problem. For example, instead of saying "out of stock," your error message should either tell users when the product will be available or provide a way for users to ask to be notified when the product is restocked.

Fortunately cPanel offers Error Pages interface that allows you to define custom error pages for any HTTP status code.

To enter Error Pages interface go to cPanel > Advanced and click Error Pages link:

cpanel error pages

If your hosting account manages more than one domain, select the domain for which you wish to edit an error page from the Managing dropdown menu:

cpanel error pages

Click the error status code link for which you wish to edit its error page:

cpanel error pages

If you do not see the desired error status code in that list, click the Show All HTTP Error Status Codes tab. Then, click on the desired error status code:

cpanel error pages

To display information on the error page about the visitor who accessed your site, click the appropriate buttons for the information that you wish to display.

Below is a brief description of the available tags:

  • Referring URL - lists the URL the visitor came from.
  • Visitor's IP address - lists the IP address of your site visitor.
  • Requested URL - shows the URL you are attempting to access
  • Server Name - shows the website domain name.
  • Visitor's Browser - lists the visitor's browser type.
  • Redirect Status Code - this will display the error message code, such as 500, or 404, etc.

Click on each link and add tag at the end of the code to place the information on a new row as you see on the screenshot below:

cpanel error pages

Click Save.

Confirmation message will be displayed:

cpanel error pages

Now if someone clicks on link to invalid web page http://hostpulse-demo.com/somepage/ on your site they will get this answer:

cpanel error pages

If you directly enter invalid URL in the browser, you'll get:

cpanel error pages

It's up to your imagination how you can use this information.

To do this yourself you need to have a basic understanding of HTML and CSS.

If you created or purchased a complete custom error page template just paste the html code in the editor and click Save (be careful to adjust the relative paths to the additional resources if the template is using such as images, .css and .js files):

cpanel error pages

cpanel error pages

One good example of 404 error page can be found on www.invisionapp.com/404:

cpanel error pages

Conclusion

We strongly recommend you to take the time and create user friendly custom error pages for your website.

Resources:

You can find very competent and useful description of HTTP Status Codes you can include in your error pages: www.restapitutorial.com/httpstatuscodes.html

In our example we used a file from a free (MIT licensed) Simple Http Error Pages package you can also download: github.com/AndiDittrich/HttpErrorPages raw.githubusercontent.com/AndiDittrich/HttpErrorPages/master/dist/pages.zip

#cpanel #design

Still not finding what you're looking for?

Contact our support team with any additional questions or concerns.

Contact support