Learn how to create custom error pages in cPanel. Our cPanel Support team is here to answer queries and concerns.
How to Create Custom Error Pages in cPanel & WHM
When users land on a broken or restricted part of a website, like a missing page (404), internal server error (500), or restricted access (403), they’re usually met with a generic error page provided by the web server. These default error messages are bland and can leave a poor impression on your visitors.
Custom error pages enhance the user experience by providing helpful information and maintaining the site’s branding, while also guiding users back to relevant content. Fortunately, if you’re using cPanel or WHM, setting up these custom pages is straightforward.
Today, we will walk through creating custom error pages for both cPanel users and WHM administrators.
An Overview:
How to Create Custom Error Pages in cPanel
To set up custom error pages for a website through cPanel, follow these steps:
- First, access the cPanel dashboard with the login credentials.
- Then, scroll down to the Advanced section and click on Error Pages.
- If the cPanel account hosts multiple domains, choose the relevant domain from the Managing dropdown menu.
- Now, we’ll see a list of common error codes:
- 400 – Bad Request
- 401 – Authorization Required
- 403 – Forbidden
- 404 – Not Found
- 500 – Internal Server Error
Click on the error code we want to customize. We will use the 404 Not Found status code for this example. If you’re still encountering issues even after setting a custom 404 page, you may want to troubleshoot deeper. Here’s a helpful resource on resolving the cPanel HTTP Error 404.
- Now, we will be taken to an editor where you can write HTML for the custom error page. Here are some of the available tags:
We can also insert dynamic tags to display helpful information.
- After crafting the message page, click Save.
We can go back and repeat this process for other error codes as needed.
You’ve now created a custom error page! You can go back and repeat this process for other error codes as needed, such as the 403 Forbidden error, which is another common issue on cPanel-based websites.
How to Create Global Custom Error Pages with WHM
If we manage a server via WHM (Web Host Manager), we can configure server-wide custom error pages. This is especially useful for hosting providers or those managing multiple sites.
- First, log in to WHM with the root credentials.
- Then, go to Server Configuration > Terminal to open the command-line interface.
- Now, run the following command:
mkdir /usr/local/apache/errorpages
This will create a folder to store the custom error pages.
- Now, go to Service Configuration > Apache Configuration.
- Click Include Editor.
- In the Pre VirtualHost Include section, select All Versions.
- Then, paste the following code in the Global Configuration field:
Alias /errorfolder /usr/local/apache/errorpages/
ErrorDocument 400 /errorfolder/400.shtml
ErrorDocument 401 /errorfolder/401.shtml
ErrorDocument 403 /errorfolder/403.shtml
ErrorDocument 404 /errorfolder/404.shtml
ErrorDocument 500 /errorfolder/500.shtml
- Now, click Update to save the changes. For those customizing Apache behavior more extensively, it might be worth reviewing how Apache Handlers work in cPanel to better understand server-side control.
- To apply the new settings, restart the Apache service. To do this, go back to the Apache Configuration page and click Restart Apache.
Now, any HTML files placed in the `/usr/local/apache/errorpages/` directory will be used as custom error pages for all hosted websites.
Customizing your error page with branding and helpful links can also help maintain trust, especially when facing connectivity issues like the ERR_SSL_PROTOCOL_ERROR that may confuse users.
[Need assistance with a different issue? Our team is available 24/7.]
Conclusion
Custom error pages are a small but powerful way to improve a website’s professionalism and user experience. They provide meaningful feedback to visitors, reduce bounce rates, and help maintain trust.
In brief, our Support Experts demonstrated how to create custom error pages in cPanel.
0 Comments