This tutorial will explain how to create a custom error page for your website in cPanel. Your website visitors can see an error page whenever an error has occurred while browsing your site. Apart from the general error pages, with custom error pages you can change the predefined error pages and add a custom message to it.
Step 1. Login to cPanel and select Error Pages from Advanced Section. Step 2. Select the domain. Step 2. Select the error page from the lists you want to customize. Step 3. Type the code you want to add in the error pages. You can also select from the buttons at the top of the page.
Login to your cPanel account and select Error Pages from the Advanced Section.
cPanel Advanced Panel: Error Pages
From the new page select the domain where you wish to display the error page. In the next step, from the lists, select the error page which you need to customize.
Error Pages in cPanel
After selecting the error page from the lists, you can add the codes which need to be displayed in the error page. Also, there are buttons at the top of the page from which you can select according to the content you need to add in the error page.
In this article, we will discuss how to create a custom error page for a “404 Requested page not found” error. The main intention behind a custom error page is to inform the visitor that the website has received the request but the requested page does not exist there.
Login to your cPanel Account and select FileManager from the Files section.
Under File Manager, go to the directory – public_html.
Click the Settings icon on the top right corner and enable Show Hidden Files.
RIght click the .htaccess file and click Edit.
Create a new .htaccess file, If you cant find one one, by clicking the +File icon on the top left corner.
Add ErrorDocument 404 “<H1>Page not found</H1>” to the .htaccess file.
The procedure to set up the error handlers via the .htaccess file is elaborated in detail with the following steps below.
Login to your cPanel account and navigate to the “File Manager” which is under the Files section.
cPanel Main Page
You’ll be taken to the File Manager Tool, where you should go to the “public_html” directory.
￼File Manager tool in cPanel
Click the Settings button at the top right side and tick the Show hidden files option and then save it.
File Manager Settings
Now, select the .htaccess file and right click to edit it. If you can’t find one then create a new .htaccess file with the “+File” option on the left side of the window.
￼Editing/Creating the .htaccess file.
The simplest way is to add the line “ErrorDocument 404 “<H1>Page not found</H1>” to the .htaccess” file without quotes. You can edit the message as you wish. And if you have written separate codes for 404 error then create a new file for that inside the “public_html”. Then the code will be “ErrorDocument 404 /404.html”, here the error handling file is named as 404.html.
The .htaccess file with a code for the custom error page – ErrorDocument 404 /404.html
To save click on the “Save Changes“. Now your website is ready to handle the 404 errors.
“Page not found” Error.
It’s always a good practice to create 404 error handling page so that the visitors won’t see weird errors in your website.