Introduction
Custom error pages let you display your own branded pages when visitors encounter errors, rather than showing default server messages. This creates a better user experience and can help guide visitors back to working pages on your site.
Method 1: Using cPanel Error Pages
- Log into cPanel
- Go to Advanced > Error Pages
- Select the domain you want to configure
- Click on the error code you want to customise (e.g., 404 Not Found)
- Edit the HTML content in the editor
- Click Save
cPanel provides several built-in variables you can use in your error pages:
- Referring URL — the page the visitor came from
- Visitor's IP Address — the visitor's IP
- Requested URL — the URL that caused the error
- Server Name — your server's hostname
- Redirect Status Code — the HTTP error code
Method 2: Using .htaccess
For more control, you can set up custom error pages using your .htaccess file:
- Create your custom error page HTML files (e.g., 404.html, 500.html) and upload them to your website
- In cPanel, open File Manager and navigate to your website's root directory (public_html)
- Open or create the .htaccess file
- Add the following lines:
ErrorDocument 400 /400.htmlErrorDocument 401 /401.htmlErrorDocument 403 /403.htmlErrorDocument 404 /404.htmlErrorDocument 500 /500.html
Each line tells the server which file to display for a specific error code. The path is relative to your website's root directory.
Tips for Effective Error Pages
- Match your site's branding — use the same header, footer, and colour scheme as the rest of your website
- Include navigation — add links to your homepage, sitemap, or popular pages so visitors can find what they're looking for
- Add a search box — if your site has search functionality, include it on the error page
- Use friendly language — explain what happened in plain English rather than technical jargon
- Include contact information — let visitors know how to reach you if they need help
Testing Your Error Pages
To test your custom error pages:
- 404 page: Visit a URL that doesn't exist on your website (e.g., yourdomain.com/nonexistent-page)
- 403 page: Try accessing a directory without an index file where directory listing is disabled
- 500 page: Intentionally add a syntax error to a test .htaccess file (remember to fix it afterwards!)
Common Error Pages to Customise
- 404 Not Found — the most commonly seen error; a must-have custom page
- 403 Forbidden — useful if you have password-protected areas
- 500 Internal Server Error — a friendly message during temporary issues
- 503 Service Unavailable — useful for planned maintenance
If you need help setting up custom error pages, please open a support ticket.