Skip to main content

How to Create a Custom HTTP Error Page in cPanel

You can create custom HTTP error pages in cPanel to provide a better user experience when a visitor encounters a broken link or a missing page. This allows you to display a branded page with helpful navigation links instead of a generic server error...

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

  1. Log in to your cPanel account.

  2. Locate the Files section and select File Manager.

  3. Navigate to the directory for the domain where you want to implement the custom page.

  4. Click + File in the top menu and name the file error_page.html (or your preferred name).

  5. Right-click the new file and select Edit.

  6. Enter your custom HTML content and click Save Changes.

  7. In the File Manager, locate the .htaccess file in the same directory.

  8. Right-click the .htaccess file and select Edit.

  9. Add the following code to the bottom of the file:

ErrorDocument 404 /error_page.html
ErrorDocument 500 /error_page.html

  1. 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.html instead 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 .htaccess file matches the actual location of your file.

  • Verify the filename: Ensure the filename in the .htaccess file matches the filename in your directory exactly (including the .html extension).

  • Check for conflicting rules: Ensure there are no other ErrorDocument lines in your .htaccess file 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.

Did this answer your question?