When a visitor to your website encounters an error message, it can be frustrating for them and potentially damaging to your website’s reputation. Default error pages can be dull and unhelpful, which is why it’s important to customize them with your own content.
Luckily, if you have a website hosted on a cPanel server, you can easily create custom error pages to display when errors occur. In this tutorial, we will guide you through the process of creating and adding custom error pages to your cPanel account.
Creating a Custom Error Page
Once you are on the Error Pages page, you will see a list of pre-defined error pages. To create a custom error page, click on the error code you want to customize. For example, you might want to create a custom error page for the 404 error.
When you click on the error code, you will be taken to the page editor where you can create your custom error page. You can add your own text, images, and formatting to the page, and even add links to other pages on your website. Once you are happy with your custom error page, click on the Save button to save your changes.
If you have multiple domains in your cPanel, select it from the Managing menu.
After creating your custom error pages, you need to add a .htaccess rule to your website’s configuration file to ensure that your custom error pages are displayed when an error occurs. To do this, navigate to the File Manager section in your cPanel dashboard.
Once you are in the File Manager, locate your website’s root directory and find the .htaccess file. If you don’t have a .htaccess file, you can create one by clicking on the +File button in the top right-hand corner of the File Manager.
Open the .htaccess file and add the following code:
ErrorDocument 404 /your-custom-error-page.html
Make sure to replace “your-custom-error-page.html” with the file name of your custom error page. Save your changes and exit the editor.
Congratulations! You have now successfully created and added custom error pages to your cPanel account. Visitors to your website will now see your custom error pages when an error occurs, providing them with a more helpful and personalized experience.