How to setup your 404 error page in Joomla 3 and Joomla 4

For each error in Joomla CMS, a "Joomla error detail page" or "404 error page" is displayed.

joomla 404 error page

When the "Show Errors" setting is turned off in "Joomla's Global Settings" → "Show Errors" and some error occurs or the user enters the wrong URL in the browser, the user will see a "404 error page".

More about: How to "turn on" or "turn off" the Error report in Joomla.

How to setup your Joomla 404 error page

1. With the help of FTP or cPanel or Joomla File mnager, go to {your-website}/templates/{your-template}/ and open file: error.php.

1.a If you don't have error.php file, Please go to {your-website}/templates/system/ or {your-website}/templates/cassiopeia/ and copy error.php file from there to your template folder.

2. In error.php file, at the file begin after row:

defined('_JEXEC') or die;

add code:

 if (($this->error->getCode()) == '404') {
  header('Location: your-wedsite-URL');
  exit;
 }

where: {your-wedsite-URL}, any correct URL on your website which you need for show users when 404 error happened.

3. If you "website developer" and know PHP, you may change {your-website}/templates/{your-template}/error.php file exactly as you need for any errors types or set this page any design.

4. For Website developers: If your website - will have real error, and you will need to debug it. Please go to {your-website}/templates/{your-template}/error.php and remove code from for 404 error page redirect which you added at steps before.

More about Joomla Errors show settings:

»