Custom 404 error page in cPanel: a step-by-step guide to setting it up

17 min read

What happens if a visitor lands on an incorrect URL and your website simply displays a generic error message? By configuring the ‘custom 404 error page in cPanel’ setting, you can make the most of this situation: the page can provide guidance that matches your brand identity, whilst the server returns the appropriate HTTP 404 status code.

It’s understandable if it’s not immediately clear which cPanel function to use to create the error page, where to upload the file, or whether you need to change your hosting settings. An incorrect redirect can not only mislead visitors, but may also result in a non-existent page returning a 200 status code.

In this guide, we’ll walk you through, step by step, how to set up a custom error page in cPanel, how to check the response code of a faulty URL, and how to revert to the previous settings if something isn’t working properly. We’ll also explain why it’s important to distinguish between a genuine 404 error and a redirect to a new, relevant URL.

What does a 404 error mean, and when is it worth setting up a custom error page in cPanel?

An HTTP 404 response indicates that the server is accessible, but the requested resource cannot be found at the specified address. This is not the same as the website or hosting being completely unavailable: in such cases, the visitor may not necessarily be able to establish a connection with the server, whereas with a 404 response, the server does respond to the requested address. Wikipedia provides a further overview of the background and typical causes of the HTTP 404 error.

Key definition: A custom 404 error page is a personalised page displayed in place of missing content. The page provides information and helps visitors navigate the site, whilst the HTTP status code remains 404, meaning that the browser and search engine crawler are informed that the requested URL cannot be found.

A custom 404 error page set up in cPanel is useful if it allows visitors to continue browsing easily even after seeing the error message. Text that is in keeping with your brand, a consistent design and clearly visible navigation can inspire confidence and help visitors find the information they are looking for. In a cPanel hosting environment, the method of configuration may depend on your hosting setup, so it is worth checking your provider’s documentation if there are any discrepancies. You can find out more about the service environment on aWh’s cPanel hosting page.

Why does a 404 error appear on a website?

A typo in the URL, a deleted page or a changed URL can all cause a 404 error. An internal link on a website – such as an old menu item – or an external link from another website can lead to an incorrect URL. This does not automatically mean that the server is malfunctioning. If a page has simply moved to a new address, the appropriate solution is usually to set up a redirect to the relevant new URL, rather than simply replacing the old content with a generic error page.

Why is a custom 404 error page useful?

The error page should briefly state that the content sought cannot be found, and then offer an obvious next step. This could be the homepage, a search box or a link to a category relevant to the topic in question. This means the visitor does not have to go back or guess what to do next. However, it is important that the error page does not list the missing content as available: alongside an eye-catching, unique design, the server must return a genuine 404 HTTP status code for the non-existent URL.

How does the custom 404 error page setting in cPanel work?

The process of setting up a custom 404 error page in cPanel consists of four parts: creating the error page file, uploading it to the hosting account, configuring it so that it appears when requests are made for missing pages, and then checking the display and the HTTP response. The steps seem simple, but the exact menu option and the file location may vary depending on the hosting provider.

In short: the error page settings determine what content is displayed when a visitor requests a non-existent URL. The page displayed can be customised, but the server must still return an HTTP 404 status code.

Where can I find the error page settings in cPanel?

Log in to your cPanel interface and look for the function relating to error page management. If the interface has a search function, try searching for ‘error pages’ or ‘404’. It is not advisable to assume the exact menu name based on a general guide, as the appearance of cPanel and the features enabled by your hosting provider may vary. If you cannot find the setting, check your provider’s documentation or knowledge base.

The file selected on the interface must be accessible on the hosting account that hosts the website. Therefore, before proceeding with the setup, please check that you are managing the account associated with the correct domain and that the file path is correct. You can also find out more about the cPanel hosting environment on aWh’s cPanel hosting page.

Video: cPanel Tutorials - Error Pages (cPanelTV)

When is the .htaccess file used?

In an Apache-based environment, you can also specify in the .htaccess file which error page should be displayed in the event of a 404 request. This is a separate configuration method compared to the function available via the cPanel graphical interface. Do not copy and paste unverified rules: first ensure that your web server supports the use of .htaccess, and that this is the correct procedure for your specific hosting environment. The UNC School of Medicine guide provides further insights into understanding and resolving 404 errors.

An incorrect rule or a typo can alter how the site works; for example, it may cause other requests to be handled incorrectly. Before making any changes, make a copy of the original file and note down what you have changed. If the website displays an error after editing, restore the original file and then check the settings against the hosting provider’s documentation. The next step is to test the error page using a non-existent URL and check the status code returned.

A custom 404 page or a redirect: which one handles the invalid URL correctly?

The appropriate solution depends on whether the content you are looking for has actually been removed or has simply moved to a different address. Configuring a custom 404 error page in cPanel informs visitors that the page is missing, but does not in itself change the server’s HTTP response. The message should therefore be clear to the visitor, whilst the incorrect URL should return a genuine 404 response.

Solution When is it suitable? Expected result
Custom 404 error page The content has been removed and there is no relevant replacement. A help page appears; the server returns a 404 status code.
Redirecting to a relevant destination The site has moved to a new address, and the content is still available there. The visitor is redirected to the new related page.
Redirect all incorrect URLs to the homepage As a general rule, this should be avoided. Visitors may not necessarily find the content they are looking for, and the ‘invalid address’ status can also be misleading.

In addition to informing the user, the error response corresponding to the missing address should remain. A customised display does not replace the correct status code. If the home page appears with a successful 200 response instead of the content of a non-existent URL, the server does not clearly indicate that the original page is missing. Redirecting all failed requests to the home page may also confuse visitors, as they may not necessarily find the topic they were looking for.

When is it appropriate to use a redirect instead of a 404 page?

A redirect is appropriate if a page has been permanently moved to a new address. For example, it is worth redirecting visitors from a previous product page to a new page about the same product if the content genuinely matches the original search query. Before setting this up, check that the content of the original and destination pages is relevant to one another. If there is no relevant new URL, retain the 404 response; choose the redirection method based on the circumstances and your server settings.

How can you avoid error status codes and redirect loops?

Immediately after making changes, open a non-existent URL, such as a deliberately incorrect path on your own domain. Check that the correct error page appears, then inspect the HTTP headers using a reliable monitoring tool: the response should be a 404 if the page cannot be found. In your browser, also check whether the address is bouncing back and forth between two URLs. A general redirect rule that applies to every request can cause an infinite loop or result in an incorrect destination page.

Step-by-step guide to setting up a custom 404 error page in cPanel

When setting up a custom 404 error page in cPanel, the file location and the assignment made in cPanel are interdependent. The exact menu item and the website’s root directory may vary depending on the hosting provider, so please refer to the provider’s documentation. The steps below will help you make the changes whilst ensuring that existing pages continue to function correctly.

  • 1. Set up your error page. Use a short, clear message, such as: ‘The page you are looking for cannot be found.’ Include a clearly visible link to the home page or a relevant category. Ensure that the text and navigation are easy to read on mobile devices. Avoid unnecessary elements so that visitors can quickly find their way forward.
  • 2. Check the website directory. Log in to cPanel, then use the file manager to locate the document root for the domain in question. Do not assume that this will have the same name or be in the same location on every hosting account. If there are multiple domains in the account, it is particularly important to select the correct website directory.
  • 3. Make a backup. Before replacing any files or changing server settings, save the relevant files, particularly any .htaccess files you may be using. Store the backup in a location that will not affect the website’s operation. This way, you can restore the previous state in the event of an error.
  • 4. Upload the file. Use cPanel’s file manager or a secure file transfer method to place the finished error page in the appropriate directory. Make a note of the file name and its exact path, as you may need this for the mapping. Check that the file can be opened directly in the browser.
  • 5. Configure this in cPanel. Locate the error page settings on the current cPanel interface. The name or location of this menu item may vary, so do not use an unverified, generic path. Select the setting for the 404 error, specify the uploaded file or its path, then save the changes. If this feature is missing, check your hosting provider’s guide.
  • 6. Test the functionality. Open a URL that you know does not exist, followed by a real, working page. Check separately whether the incorrect address displays the new error page and whether the existing page loads as normal. Use a reliable header checker tool to ensure that the non-existent URL returns an HTTP 404 status code.

If an error occurs after making the change, restore the files from the backup and check the path again, as well as the setting selected in cPanel. For details of the hosting environment, see aWh’s cPanel hosting.

Checking, fixing and securely maintaining 404 error pages

The configuration of a custom 404 error page in cPanel is only considered complete if not only does it look correct, but the HTTP response for the incorrect URL is also correct. After configuration, check the error page and test it again later if you modify your website’s routes or server settings.

  • Appearance: the error page matches the website’s design, and the text is brief and clear.
  • Navigation: links to the home page or other relevant content are working.
  • Invalid URL: a non-existent address displays the custom page that has been set up.
  • HTTP status code: the server returns a 404 response for the missing address; a 200 response indicates success.

You can check the page’s appearance in a browser and verify the status code using a tool that analyses HTTP headers. It’s also worth opening an existing page to check whether the change has affected the rest of the website.

Why isn’t my custom 404 error page appearing?

First, check that the file is in the correct website directory and that the filename and path match exactly those specified in cPanel. If you have multiple domains, check that you have modified the settings for the correct domain. If the default error page is still displayed, an existing redirect or other server configuration may be overriding the setting.

If, after making the changes, other pages do not load correctly either, restore the backup you made of the original configuration. You should do this particularly if you have edited the .htaccess file. Then check the working and missing URLs again. Do not leave any rules in place whose effect is unclear.

When should you ask your web hosting provider for help?

Please contact your service provider if the error page function is not available in cPanel, or if it is unclear how the web server handles 404 requests. In your report, please provide the incorrect URL, the result you received and the date and time of the change. Please also indicate whether a custom page appears and what status code you see. This information will help us investigate the issue more thoroughly.

For further information on using and configuring the cPanel interface, please visit the aWh knowledge base. If the interface or hosting environment differs from that described in the guide, please refer to your provider’s documentation to continue troubleshooting.

Enhance your website’s user experience

Setting up a custom 404 error page in cPanel works well when the visitor receives useful guidance, whilst the non-existent URL continues to return a 404 HTTP response. The decision is simple: if there is no relevant replacement page, display a custom error page; if the content has moved to a new address, redirect the visitor there. Take a backup of the original configuration, then check the error page’s appearance, navigation and status code.

The right hosting environment and knowledge of cPanel make it easier to manage settings transparently. aWh serves its customers with over 10 years’ experience in the web hosting industry, cPanel hosting and an experienced support team. Its top-tier security solutions include automatic backups.

Take a look at aWh’s cPanel hosting solutions and choose the hosting environment that best suits your needs. With a carefully configured error page, an incorrect URL doesn’t necessarily mean the end of the road for your visitors.

Frequently asked questions about custom 404 error pages

How do I set up a custom 404 error page in cPanel?

Create a short error page that is easy to read on mobile devices, then upload it to the appropriate directory on the affected website. The exact location of the directory may vary depending on your hosting provider. In cPanel, locate the function for managing error pages, select the setting for the 404 error, and assign the file to it. After saving, test a non-existent URL and check the response code as well.

What happens if a custom 404 page does not return a 404 status code?

If the content of the missing page is displayed but the server returns a 200 response, the browser and search engine crawler may interpret the page as a successful request. This is often referred to as a ‘soft 404’ status. The page display alone does not guarantee the correct status code, so you should also check the HTTP headers. If the content does not exist, the server must return a 404 response.

Where can I find the error page settings in cPanel?

In the cPanel interface, look for the function relating to error page management. The name and location of this menu item may vary depending on the version of the interface and your hosting provider’s settings, so it is not advisable to assume that a single path applies to all accounts. If you cannot find the feature, check your provider’s documentation or knowledge base. It may be that this setting is not available for your account.

Can the .htaccess file be used to set up a custom 404 page?

Yes, on Apache-based hosting, you can also specify a rule for the 404 error page in the .htaccess file, provided the environment supports this. Before making any changes, check the type of web server and consult your hosting provider’s guide. Make a backup of the original file, as an incorrect rule may affect the functioning of other parts of the website. After saving, check the broken and working URLs.

Should I redirect pages that cannot be found to the homepage?

Do not automatically redirect every missing URL to the home page. If the content has been permanently removed and there is no relevant replacement, display a custom error page that returns a 404 response. If the page has been moved to a new, thematically related address, redirect the visitor there. The destination page must genuinely correspond to the content of the previous page; otherwise, the redirect may mislead the visitor.

How can I check that the 404 error page is working properly?

Go directly to a URL that definitely does not exist on your website. Check whether your own error page appears, whether the navigation links work, and whether the response contains an HTTP status code 404. You can check the code using a reliable header checker tool. Then open an existing page as well to ensure that the change has not affected its loading.

Why isn’t my custom 404 page appearing on the website?

Common causes include an incorrect file path, a misspelt filename or an incorrect website directory. Also check that you have assigned the file to the correct domain in cPanel, and that the setting is not being overridden by a previous redirect or server configuration. If you have modified a configuration file and other pages are also malfunctioning, restore the original version and then contact your hosting provider for assistance.

Back to the blog