How to Create Custom Error Pages
Error pages help inform visitors that there’s an issue with the webpage they’re trying to reach. A code number usually represents every error. For example, when a visitor is entering a nonexistent URL, they will get a 404 error. While unauthorized visitors accessing your website’s restricted area will see a 401 error.
Your web server software usually takes care of basic error pages. In this tutorial, you’ll learn how to create a custom one using the cPanel, to show HTTP status codes from 400 to 510.
Step 1. Locate and Enter the Error Pages
The Error Pages tool is located under the Advanced section. Find and open it.
Step 2. Select an Error Page for Editing
Once it is opened, you can do the following:
- Managing — here you can select the domain that will use the error page
- Error Code List — you need to select the proper error page to make. By default, cPanel only shows the five most common error pages. If you want to see the remaining list, click the Show All HTTP Error Status Codes tab
Step 3. Edit the Error Page
Once you choose which code to work with, you’ll be directed to the editing screen. Here you can use HTML code and insert some tags.
- Referring URL — shows the URL that visitors come from
- Visitor’s IP Address — shows the visitors’ IP
- Requested URL — shows the URL that visitors are trying to access
- Server Name — shows the server name
- Visitor’s Browser — shows the browser type the visitor uses
- Redirect Status Code — shows the error code
You can experiment with the variables to create a better custom error page. In the example, we’re trying to retain visitors by giving them a link to our homepage. Once you’re satisfied with the result, click Save.
You can simulate how the error page looks by simply entering a non-existing URL, such as https://www.yourdomain.com/non-existing-url.html to your browser.
It’s a good thing to have custom error pages, as not all visitors understand status codes. It’s also an effective way to retain visitors on your website, by offering them a chance to navigate to a URL that actually exists.