Development and databases

Customise 404 and other error pages

Reviewed on 3 min read paginas de error 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 the request is handled by WordPress or another application, its own error template may take priority.

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.
  3. Enter a simple message and valid links. For the 404, say the page was not found and offer navigation.
  4. Save and visit a non-existent URL on that domain.

cPanel uses files such as 404.shtml. 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 show

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 their own response.

Avoid including internal paths, 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 relevant route.

You may also find useful

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