Before you begin
You will need:
A cPanel account
Access to the File Manager or an FTP client
The HTML content for your custom error page
Create your custom error page
Log in to your cPanel account.
Locate the Files section and select File Manager.
Navigate to the directory for the domain where you want to implement the custom page.
Click + File in the top menu and name the file
error_page.html(or your preferred name).Right-click the new file and select Edit.
Enter your custom HTML content and click Save Changes.
In the File Manager, locate the
.htaccessfile in the same directory.Right-click the
.htaccessfile and select Edit.Add the following code to the bottom of the file:
ErrorDocument 404 /error_page.html ErrorDocument 500 /error_page.html
Click Save Changes.
Note: The path provided in the .htaccess file (e.g., /error_page.html) must be relative to your domain's root directory.
Confirm the result
To verify that the custom page is active, you can perform the following tests:
Navigate to a non-existent URL on your website (e.g.,
example.com/this-page-does-not-exist).Confirm that the browser displays your custom
error_page.htmlinstead of the default server error.Repeat the test with a known broken link if available.
Troubleshooting
If the browser still displays a default server error page instead of your custom page:
Check the file path: Ensure the path in the
.htaccessfile matches the actual location of your file.Verify the filename: Ensure the filename in the
.htaccessfile matches the filename in your directory exactly (including the.htmlextension).Check for conflicting rules: Ensure there are no other
ErrorDocumentlines in your.htaccessfile that might override your settings.Clear your browser cache: Sometimes a browser will cache the old error page. Clear your cache or try viewing the page in an Incognito/Private window.
