You can customise error pages to assist your website visitors in identifying any problems they may encounter. For example, if they were to attempt to access a file that no longer exists or a password protected folder.
By default, in cPanel, each page should have a .shtml ending. However that extension doesn't support many modern technologies, like database queries for example.
There are way around this. The most common is the following:
We recommend you backup your .htaccess file before making any changes.
- Login to cPanel and click on File Manager under the Files section.
- Make sure "Web Root" is selected and that "Show Hidden Files" is ticked, then click "Go".
- Right click on the .htaccess file and then select "Code Edit". Click on "Edit" if another windows pops up after selecting "Code Edit".
- Unless someone has previously edited the .htaccess file it should be blank. Add the following code to the file (changing "mysite" to your domain and changing http to https if your domain has SSL):
# Error redirect pages
http://www.mysite.com/404.php ErrorDocument 400
http://www.mysite.com/404.php ErrorDocument 401
http://www.mysite.com/404.php ErrorDocument 403
http://www.mysite.com/404.php ErrorDocument 404
http://www.mysite.com/404.php ErrorDocument 500
- Once you've done this click save at the top right and then click on close.
This will redirect any website visitor to the 404.php page should they encounter any of the following codes; 400, 401, 403, 404, or 500. You can also change the "404.php" part to other files to have a different page for each one.
Please get in touch with our support team if you require further assistance.