1. Home
  2. Error Pages in cPanel

Error Pages in cPanel

Upon new hosting account activation the public_html directory contains the 401.shtml, 403.shtml, 404.shtml, 500.shtml files.

These are the most common error pages which the web server uses upon generating some of the 401, 403, 404, 500 status codes.

The .shtml files are ordinary HTML files containing SSI tags. These tags are processed by the web server and the result is embedded into the page before it is sent to the web browser.

Enabling .shtml files

If you would like a certain error message to use the respective .shtml file in the .htaccess file, located in the same directory, you need to place the respective directive. If you want the 404 message to load the /404.shtml file, located in the website directory, you need to use:

ErrorDocument 404 /404.shtml

The ErrorDocument directive points the web server to load the specified 404.shtml file in case of a 404 Not Found status code.

Important: Processing some of the status codes and displaying the respective error message might be performed by the website’s system. For example in WordPress the 404 Not Found message is processed by the PHP system itself (when the .htaccess already contains the rules for permanent URLs). Therefore changing the system 404.shtml file will not affect the error message, displayed on the website. In such case, you can edit the 404 message in WordPress from the 404.php template, usually located in the theme’s directory.

Editing Error Pages (.shtml)

System error messages might be directly edited through the File Manager’s editor or the Error Pages menu in cPanel.

After you select the domain you will see the most common error messages in the list below.

Besides the enlisted choices you can also edit messages for other status codes such as 408, 502, 503 and others.

To edit a message, click on it. A code editor will open as you will see the existing content of this system message.

It might contain an HTML code as well as the special system SSI tags used to generate dynamic data such as server name, request URL, visitor’s IP and others. E.g. 404.shtml contains:

<!DOCTYPE html>
<title>404 Not Found</title>
<h1>Not Found</h1>
</p>The requested URL <!--#echo var="REQUEST_URI" --> was not found on this server.</p>

<!–#echo var=”REQUEST_URI” –> is an SSI tag that will be replaced with the URL requested by the web client.

A few examples for SSI tags which might be included into an error message:

Referring URL

<!--#echo var="HTTP_REFERER" -->

Visitor’s IP

<!--#echo var="REMOTE_ADDR" -->

Request URL

<!--#echo var="REQUEST_URI" -->

Server name

<!--#echo var="HTTP_HOST" -->

Visitor’s browser

<!--#echo var="HTTP_USER_AGENT" -->
Important: Editing .shtml files through cPanel » Error Pages does not activate them on the website (which means directives are not added to the .htaccess file).
Updated on 18.03.2022

Was this article helpful?