Tag Archives: error codes

How to Create a Custom WordPress 404 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.

Quick Steps

  1. Login to your cPanel Account and select File Manager from the Files section.
  2. Under File Manager, go to the directory –  public_html. 
  3. Click the Settings icon on the top right corner and enable Show Hidden Files.
  4. RIght click the .htaccess file and click Edit.
  5. Create a new .htaccess file, If you cant find one one, by clicking the +File icon on the top left corner.
  6. 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.