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 File Manager 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.
You’ll be taken to the File Manager Tool, where you should go to the “public_html” directory.
Click the Settings button at the top right side and tick the Show hidden files option and then save it.
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.
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.
To save click on the “Save Changes“. Now your website is ready to handle the 404 errors.
It’s always a good practice to create 404 error handling page so that the visitors won’t see weird errors in your website.
If you have any web hosting questions please feel free to reach out to us. We're happy to help.
Our Guiding Principles
- Provide consistent, stable, and reliable web hosting services.
- Ensure rapid ticket response and quick resolutions to issues.
- Never saturate or over-provision servers to ensure stability and speed for our customers.
- Use only high-quality enterprise-class hardware to ensure minimal downtime from hardware failures.
- Provide clear pricing with no hidden fees or gotchas.