A decent 404 page is quite important. This error means that a certain page is not found. If you do not make your own 404 page, the error you will see is quite technical and can scare off your visitors. Cassiopeia has ha 404 page, but you can create your own if you want to.
In order to do this, do the following:
- Create a menu. You can have it hidden or not, it is your choice. For instance, name the menu 404-not-found.
- Create an article, with the minimum contents of:
- why they came to the 404 page
- a search option
- a contact option, or alternatives - Put step 1 and 2 together, and have the menu linked to the page.
- If your template does not have an error.php, make it in /templates/yourtemplate/error.php
and fill it with the following contents:
<?php
/**
* @package Joomla.Site
* @subpackage Template.system
*
* @copyright Copyright (C) 2005 - 2021 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
if (($this->error->getCode()) == '404') {
header('Location: /404-not-found');
exit;
}
?>
- Make sure the black portion is equal to the menu name you made in step 1 (to be specific, the alias!)
Voila, you now have a working 404 page that you can control yourself!
NOTE: when you have a template update, please make a backup of the error.php because it will be overwritten.