Development and databases

Customise 404 and other error pages

Reviewed on 3 min read error pages cPanel

A useful error page explains what has happened and offers a way out, such as going back to the home page or looking for other content. You can customise the server's responses from cPanel > Error Pages. If you use WordPress, Joomla, PrestaShop, Magento or similar, this option has no effect: the application handles its own error pages from its theme or template.

Create the page in cPanel

  1. Open Error Pages and select the right domain if a selector appears.

  2. Choose the code you are going to customise, for example 404, for an address that does not exist.

    Choosing the error code in cPanel Error Pages

  3. Write the content in the editor. It accepts HTML, so you can add your logo, a message and links to the home page or the search page. With the buttons at the top you insert tags that show request data: the requested URL, the page the visitor came from (referring URL), the visitor's IP or browser and the server name.

    Error page editor with the available tags

  4. Save and visit a non-existent URL on that domain.

cPanel saves the page as 404.shtml in the domain's root folder; you can also upload that file directly over FTP. If you add images or styles, check their paths from a non-existent address that is also inside a subfolder. The error page's resources must still be available when the failure happens.

Keep the right HTTP code

How the page looks and its HTTP code are different things. A 404 must still respond 404, even if it shows a full design. Returning 200 with a "not found" message can make search engines treat it as a soft 404.

Check the status in the Network tab of the browser's developer tools after reloading a non-existent URL. If you use a terminal tool, look at the headers of the real response and check for redirects.

For temporary maintenance use a 503 response, with a lightweight page that does not depend on the application under maintenance. See the maintenance guide with .htaccess.

When the change does not appear

If the application catches the request before the server does, customise the error page inside the application or its theme. Also check caches and proxies that may be showing a response of their own.

Avoid including internal paths, stack traces, credentials or server details on the public page. If you use tags that insert request data, check how they are handled and do not add content received from the visitor without proper escaping.

A custom page helps the visitor, but it does not fix the cause of a 500 error or bring back a URL that should exist. In those cases check the logs or restore the corresponding path.

You may also find useful

Something wrong or out of date? Tell us and we will review it.