Custom error pages not working

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 ErrorDocument 400 ErrorDocument 401 ErrorDocument 403 ErrorDocument 404 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.

Is article helpful?