When something goes wrong on your website, such as a blocked page or a server error, your visitor normally sees a plain, generic message by default. You can replace that message with your own branded page that matches your website's design and gives the visitor something useful to do next, such as a link back to your homepage.
Which Error Codes You Can Customize
Most error pages work the same way behind the scenes, whether it's a 403 Forbidden, 500 Internal Server Error, 503 Service Unavailable, or another code. You create a page with the message you want, then tell your website to show that page whenever that specific error happens, instead of the server's default message.
If you only want to customize the "Page Not Found" error, see our guide on creating a custom 404 error page. This article covers the other error codes.
In cPanel
- Log in to cPanel and go to the Advanced section.
- Click Error Pages.
- Choose the domain you want to edit from the dropdown, if you have more than one domain on the account.
- Select the error code you want to customize, such as 500 (Internal Server Error).
- Edit the HTML in the box provided. You can use the placeholder tags listed on the page, such as the ones that insert the visitor's IP address or the page they were trying to reach, to make the message more specific.
- Click Save.
Repeat these steps for each error code you want to customize. cPanel saves each one separately.
In DirectAdmin
DirectAdmin doesn't have one built-in tool that lists every error code the way cPanel does, but you can get the same result by creating the error page yourself and pointing your website to it with a simple rule.
- Open File Manager and create a new file in your public_html folder, for example 500.html, containing the message you want visitors to see.
- Open or create the .htaccess file in the same folder.
- Add a line for each error code you want to customize, for example: ErrorDocument 500 /500.html.
- Save the file.
This same .htaccess method also works in cPanel, so it's a useful fallback if you ever need to customize an error code the Error Pages tool doesn't list.
A Few Things to Keep in Mind
- Keep your custom error page simple and fast-loading. If the real problem is a database connection or a script failure, a page that depends on the same database or script could fail to load too.
- Use plain HTML with inline or embedded styling rather than linking to external stylesheets or scripts, so the page still displays correctly even if other parts of your site are down.
- Test each error page after setting it up. You can usually trigger a 403 by requesting a page inside a password-protected folder, and a 404 by requesting a page that doesn't exist on your site.
A custom error page doesn't fix the underlying problem, such as a misconfigured script causing 500 errors. It only changes what the visitor sees while you troubleshoot the real cause.