Applies to: All plans (Self-Managed and Managed).
Before you start: You need access to cPanel for the hosting account whose site you want to customise. Log in from your client area (open the service, then Log in to cPanel), or go to https://yourdomain/cpanel.
A custom error page replaces the plain default message visitors see when something goes wrong — for example a 404 (Not Found) when a page does not exist, or a 500 (Internal Server Error) when a script fails. A branded error page keeps visitors on your site and points them somewhere useful instead of a blank server message.
There are two ways to do this. The built-in Error Pages tool is the easiest for most people. If you prefer to use your own HTML file, the second method via .htaccess gives you more control.
Option A — use the Error Pages tool
- In cPanel, open Advanced -> Error Pages (the option may simply be labelled Error Pages).
- If you host more than one domain on the account, choose the domain you want to edit from the list at the top.
- Pick the error code you want to customise, such as 404 (Not Found) or 500 (Internal Server Error).
- In the editor, type or paste the HTML for your page. You can use the quick-insert buttons to add details like the referring page or the visitor's IP.
- Click Save.
Result: Visitors who hit that error on the selected domain now see your custom page instead of the default server message.
Option B — use your own .htaccess file
Use this method if you have already designed an error page as an HTML file (for example 404.html).
-
Upload your error-page file to your site using cPanel -> Files -> File Manager, or over FTP/SFTP. A common place is your document root (usually public_html).
-
In File Manager, open (or create) the .htaccess file in the same folder. Enable Show Hidden Files (dotfiles) in the File Manager settings if you cannot see it.
-
Add a line for each error you want to handle, pointing to your file, then save:
ErrorDocument 404 /404.html ErrorDocument 500 /500.html -
Visit a non-existent URL on your site (for example yourdomain/this-page-does-not-exist) to test it.
Result: Our LiteSpeed web server reads your .htaccess and serves your custom file for each error code you defined.
Troubleshooting this task
- Still seeing the default page? Clear your browser cache and try a private/incognito window. If you use the LiteSpeed Cache plugin, purge its cache too.
- A custom 500 page never shows up. A 500 error usually means a script or app is broken, so the cause needs fixing as well — see My website is down or showing a 500 error.
- You see a 508 "Resource limit reached" instead. That is a different message about your account hitting its CloudLinux limits, not a page you set — see "Resource limit reached" and 508 errors explained.
-
The .htaccess path is wrong. Paths in
ErrorDocumentare relative to your domain root and must start with a/. Make sure the file actually exists at that path in File Manager.
Comments
0 comments
Please sign in to leave a comment.