You can create custom error pages for your website to display user-friendly messages when something goes wrong. These are especially helpful for pages like "404 Not Found" or "403 Forbidden."
How to Set Up Custom Error Pages
For the Primary Domain
- Create an HTML or SHTML page with your custom message.
- Name the file based on the HTTP error code: 404.shtml – for "Page Not Found" / 403.shtml – for "Forbidden" / 500.shtml – for "Internal Server Error" (and so on…)
- Upload the file to your site’s root directory (public_html/).
- The server will automatically use these pages if the file extension is .shtml.
For All Domains via cPanel or .htaccess
To apply a global custom error page:
- You can either use the Error Pages tool in cPanel, or
- Manually edit your .htaccess file in public_html/ and add this line: nginx
ErrorDocument 404 /404.shtml
For Addon or Subdomains
To create different error pages for addon or sub-domains:
- Place a .htaccess file inside that domain’s folder.
- Use the full URL path in the command like this:
ErrorDocument 404 http://example.yourdomain.com/404.html
Note: You can redirect to error pages with any extension (.html, .php, etc.). It doesn’t have to be .shtml.