When a visitor encounters an error on your website (like a missing page or a server error), the web server displays a default error page. You can customise these pages to match your site's branding and provide helpful information.
Please note: Screens and options may vary slightly depending on your cPanel version and hosting plan.
Customising Error Pages in cPanel
- Log in to your cPanel account.
- In the Advanced section, click Error Pages.
- Select the domain.
- Click on the error code you want to customise.
- Edit the HTML content. You can use the built-in editor or enter your own HTML.
- Click Save.
Common Error Codes
| Code | Meaning | When It Occurs | |------|---------|----------------| | 400 | Bad Request | The server can't understand the request. | | 401 | Unauthorised | Authentication is required. | | 403 | Forbidden | The server refuses to fulfil the request (e.g. directory listing disabled, file permissions). | | 404 | Not Found | The requested page doesn't exist. | | 500 | Internal Server Error | A server-side error (e.g. PHP error, .htaccess misconfiguration). | | 503 | Service Unavailable | The server is temporarily overloaded or under maintenance. |
Custom 404 Page Best Practices
Your 404 page should:
- Clearly state that the page wasn't found.
- Maintain your site's branding, header, and navigation.
- Provide a search bar to help visitors find what they're looking for.
- Link to your homepage and key sections of your site.
- Optionally include a contact link for visitors who need help.
Using .htaccess for Custom Error Pages
You can also set custom error pages via .htaccess:
ErrorDocument 404 /custom-404.html
ErrorDocument 500 /custom-500.html
ErrorDocument 403 /custom-403.html
Create the corresponding HTML files in your document root.
Tips
- Custom error pages are a simple way to improve user experience and keep visitors on your site rather than losing them to a generic error page.
- Include your site's analytics tracking code on error pages so you can monitor how often visitors hit them.
- Monitor your error logs and 404 reports to find and fix broken links on your site.
What Next?
- Understanding .htaccess Files — Advanced error page configuration.
- Viewing Error Logs — Identify what's causing errors.