Custom Error Pages (403, 404, 500)
Create custom error pages to provide a better user experience when errors occur.
What Error Codes Mean
| Code | Meaning |
|---|---|
| 400 | Bad Request |
| 401 | Unauthorized |
| 403 | Forbidden — no permission to access |
| 404 | Not Found — page does not exist |
| 500 | Internal Server Error |
| 502 | Bad Gateway |
| 503 | Service Unavailable |
In cPanel
- Go to Error Pages
- Select the error code
- Edit the HTML content
- Save
Via .htaccess
Add these lines to your .htaccess file:
apache
ErrorDocument 404 /errors/404.html
ErrorDocument 403 /errors/403.html
ErrorDocument 500 /errors/500.htmlThen create the corresponding HTML files in an errors folder.
Best Practices for Error Pages
- Include your site branding and navigation
- Provide a search box or links to popular pages
- Keep the page lightweight (no heavy scripts)
- Suggest the homepage or contact page
- Do not reveal technical details to visitors
WordPress
WordPress handles 404 pages through your theme 404.php file. Edit this in Appearance → Theme Editor or via FTP.