In this article, you will learn to create a custom error page for a โ404 Requested page not foundโ error. The main reason for creating a custom error page is to inform the visitor that the website has received the request but the requested page isnโt available.
Steps to Create a Custom WordPress 404 Error Page
- At first, login to yourย cPanel Accountย and from theย Filesย section, selectย File Manager.
- Inย File Manager, go to the directory โย public_html.
- On the top right corner, click theย Settingsย icon and enableย Show Hidden Files.
- Right click the .htaccess file and clickย Edit.
- You can create a new .htaccess file, if you canโt find one by clicking theย +Fileย icon on the top left corner.
- Then addย ErrorDocument 404ย โPage not foundโย to the .htaccess file.
Steps to Set Up the Error Handlers via the .htaccess File
- Login to your cPanel account and go to theย โFile Managerโย under theย Filesย section.

- You will be redirected toย File Manager Tool. Now go to theย โpublic_htmlโย directory.

- At the top right side, click theย Settingsย button, tick theย Show hidden filesย option and save it.

- Then right click on the .htaccess file to edit it. If you donโt have one, create a new .htaccess file with theย โ+Fileโย option on the left side of the window.

- You can simply add the lineย โErrorDocument 404 โ<H1>Page not found</H1>โ to the .htaccessโย file without quotes. The message can be edited as per your preference. In case 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โ. In this code, the error handling file is named as 404.html.

- Then clickย โSave Changesโย to save. With this, your website is ready to handle the 404 errors.

To create a 404 error handling page is a good practice so that the visitors wonโt see any strange errors on your website.


