cPanel

Create custom 404, 403 and 500 error pages in cPanel

Replace the plain server error pages with branded 404, 403, 500 and other pages using cPanel Error Pages, server-side tags, or ErrorDocument rules in .htaccess.

BeginnercPanel hosting2 min read

When a visitor hits a missing page or an error, the server shows a plain technical message by default. A custom error page keeps your branding, explains what happened and links back to useful pages, so visitors stay on your site instead of leaving. cPanel's Error Pages tool creates them without coding.

Before you start

  • Content management systems such as WordPress, Joomla or shop software show their own theme-based 404 page for URLs they handle. Customise those inside the CMS. cPanel error pages apply to static sites and to errors the CMS never sees (for example 403 or 500 from the server).
  • Prepare short texts and links: home page, search, contact.

Create an error page

  1. Open cPanel → Advanced → Error Pages.
  2. Choose the domain from Managing.
  3. Click the error code, for example 404 (Not Found). Use Show All HTTP Error Status Codes for less common ones.
  4. Write the page in HTML in the editor. Use the buttons above it to insert server tags:
    • Referring URL: where the visitor came from
    • Visitor's IP Address
    • Requested URL: the address that failed
    • Server Name, Visitor's Browser, Redirect Status Code
  5. Click Save. cPanel creates a file such as 404.shtml in the domain's document root.

A simple, useful 404 page:

<h1>Page not found</h1>
<p>Sorry, <!--#echo var="REQUEST_URI" --> does not exist (any more).</p>
<p><a href="/">Go to the home page</a> or <a href="/contact">contact us</a>.</p>

Tip: Use absolute links (starting with /) and absolute paths for CSS and images in error pages. They can be shown for any URL depth, so relative links break.

Use your own page file with .htaccess

You can point errors to any page you designed, even a PHP page, with ErrorDocument lines in .htaccess:

ErrorDocument 404 /errors/not-found.html
ErrorDocument 403 /errors/forbidden.html
ErrorDocument 500 /errors/server-error.html
  • Always use a local path, not a full https:// URL. A full URL makes the server send a redirect with status 302 instead of 404, which confuses search engines.
  • A 500 page should be plain HTML, because PHP may be the thing that is broken.

Which errors are worth a custom page?

CodeWhen
404 Not FoundMissing pages; the most common and most important
403 ForbiddenBlocked folders or IPs
500 Internal Server ErrorScript or configuration failures
401 UnauthorizedCancelled login on a password-protected folder
503 Service UnavailableMaintenance or overload

Troubleshooting

  • Custom page not shown: the CMS handles the URL; edit its 404 template. Or another ErrorDocument line overrides yours.
  • Page shows unstyled: relative paths to CSS; make them absolute.
  • Fixing the errors themselves: see 404, 403 and 500 guides.

Next steps

Was this guide helpful?

Still stuck?

Ask MdmHost AI for a quick answer, or open a ticket and our team will take a look. We are here 24/7.