Managing Custom Error Pages in cPanel
Last Updated: 2025-01-01
3 min read
When visitors encounter an error on your website, the server displays a default error page. These generic pages are not user-friendly and offer no guidance. cPanel lets you create custom error pages that match your site’s design and help visitors navigate back to working content.
Common HTTP Error Codes
| Code | Name | When It Appears |
|---|---|---|
| 400 | Bad Request | The server cannot understand the request |
| 401 | Unauthorized | Authentication is required but not provided |
| 403 | Forbidden | Access to the resource is denied |
| 404 | Not Found | The requested page does not exist |
| 500 | Internal Server Error | A server-side error occurred |
Creating Custom Error Pages in cPanel
- Log in to cPanel.
- Navigate to the Advanced section.
- Click on Error Pages.
- Select the domain you want to configure error pages for (if you have multiple domains).
- Click on the error code you want to customize (e.g., 404 Not Found).
- The error page editor opens with a simple HTML editor.
- Enter your custom HTML content. You can include:
- Your brand logo and styling
- A helpful message explaining the error
- Links back to your homepage or sitemap
- A search box for your website
- Click Save to apply the custom error page.
Example Custom 404 Page
<!DOCTYPE html>
<html>
<head>
<title>Page Not Found</title>
<style>
body { font-family: Arial, sans-serif; text-align: center; padding: 50px; }
h1 { font-size: 48px; color: #333; }
p { font-size: 18px; color: #666; }
a { color: #0066cc; text-decoration: none; }
</style>
</head>
<body>
<h1>404</h1>
<p>Sorry, the page you are looking for could not be found.</p>
<p><a href="/">Return to Homepage</a></p>
</body>
</html>
Available Template Tags
cPanel provides special tags you can use in your error pages:
| Tag | Description |
|---|---|
<!--#echo var="REDIRECT_STATUS"--> | The HTTP error status code |
<!--#echo var="REDIRECT_URL"--> | The URL that caused the error |
<!--#echo var="HTTP_HOST"--> | The domain name |
<!--#echo var="SERVER_ADDR"--> | The server IP address |
Using .htaccess for Error Pages
You can also define custom error pages using your .htaccess file:
ErrorDocument 404 /custom_404.html
ErrorDocument 500 /custom_500.html
ErrorDocument 403 /custom_403.html
Place the corresponding HTML files in your public_html directory. This method gives you more flexibility, especially if you want to use a PHP script for your error pages.
Best Practices
- Match your site’s design — custom error pages should look like part of your website, not a dead end.
- Include navigation — give visitors a way to get back to useful content.
- Keep it simple — avoid loading heavy resources on error pages since the issue might be server-related.
- Test your error pages — visit a non-existent URL on your site to verify the 404 page works correctly.
- Avoid redirecting errors to the homepage — this confuses visitors and is bad for SEO. Show the error page at the original URL instead.
Well-designed error pages improve user experience and can help retain visitors who would otherwise leave your site.
Tags:
cpanel
hosting
error-pages
customization