Why Use Custom Error Pages?
When visitors encounter an error on your site, the default server error pages are plain and unhelpful. Custom error pages provide a branded experience, guide visitors back to working pages, and help retain users who might otherwise leave your site immediately.
Common Error Codes to Customise
- 400 Bad Request – The server cannot process the request due to a client error
- 401 Unauthorized – Authentication is required to access the resource
- 403 Forbidden – The server refuses to fulfil the request
- 404 Not Found – The requested page or file does not exist
- 500 Internal Server Error – A generic server-side error occurred
- 503 Service Unavailable – The server is temporarily unable to handle the request
Method 1: Using .htaccess
The simplest way to set up custom error pages is through your .htaccess file. Add the following directives:
ErrorDocument 400 /errors/400.html
ErrorDocument 401 /errors/401.html
ErrorDocument 403 /errors/403.html
ErrorDocument 404 /errors/404.html
ErrorDocument 500 /errors/500.html
ErrorDocument 503 /errors/503.html
Create the corresponding HTML files in an /errors/ directory within your web root.
Method 2: Using cPanel
- Log into cPanel and navigate to Advanced > Error Pages
- Select the domain you want to configure
- Click on the error code you want to customise
- Enter your custom HTML content in the editor and save
Best Practices for Error Pages
- Keep your branding – Include your logo, navigation, and colour scheme so visitors know they are still on your site
- Provide helpful links – Add links to your homepage, popular pages, a search bar, or a sitemap
- Use friendly language – Avoid technical jargon. A message like "We could not find that page" is better than "404 Not Found"
- Include a search function – Help visitors find what they were looking for
- Keep it lightweight – Avoid external dependencies in your error pages in case those resources are also failing
Well-designed error pages turn a frustrating experience into a chance to keep visitors engaged with your site.