An error page informs a visitor when there is an issue visiting your website. Every problem has a dedicated number (code). For example, a visitor entering an URL that does not exist anymore will be presented a 404 error, an unauthorized visitor accessing a protected section of your website will be given a 401 error code.
Basic error pages are commonly automatically provided by the web server software. In this tutorial, you will learn how to create a custom error page for any valid HTTP status code beginning in 4 or 5.
What you’ll need
Before you begin this guide we assume that you already have:
- Access to the cPanel of your hosting account.
Step 1 — Entering Error Pages section
First of all, log into the cPanel. Locate Advanced section and click Error Pages icon in it.
Step 2 — Selecting an error page for editing
Once in the Error Pages section, perform these steps:
- From the Managing drop-down field, select the domain for which you want to edit the error page.
- In the below list, select the exact error page to be edited. By default, cPanel shows a list 5 most common error pages – 400, 401, 403, 404 and 500. If you wish to see the full list, click Show All HTTP Error Status Codes tab and select the page from the full list.
Step 3 — Editing the error page
In the error page editing screen, you can enter HTML code or insert some useful tags.
- Referring URL shows what URL the visitor came from.
- Visitor’s IP address shows the IP address of your site visitor.
- Requested URL shows the URL the visitor is attempting to access.
- Server Name shows the name of the server.
- Visitor’s Browser lists the visitor’s browser type.
- Redirect Status Code displays the error message code, such as 404, or 500, etc.
Feel free to experiment with the variables and create a page to better explain to the visitor why this page is shown. In our example above, we are trying to retain the visitor by giving him a chance to follow the link to our homepage. After you are done, just click Save and your modifications will be saved. To check the error page in action, you have to simulate the error for your website. For example, to check the 404 error page, simply visit a URL on your website that is non-existing, such as http://www.*your-website.com*/non-existing-url.html (replace your-website.com with your actual domain name).
This tutorial showed you the steps needed to create a custom error page using cPanel. Only a small amount of visitors understand the basic error pages so it is always a good idea to have your own custom error pages defined for your website.