How to setup your 404 error page in Joomla?
A 404 error page appears when a visitor tries to access a page that doesn't exist. Setting up a custom 404 page in Joomla is important for improving user experience, keeping visitors on your site, and even helping your SEO.
For each error in Joomla CMS, a "Joomla error detail page" or "404 error page" is displayed.
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 Manager, go to {your-website}/templates/{your-template}/ and open file: error.php.
1.a If you don't have error.php file, go to {your-website}/templates/system/ or {your-website}/templates/cassiopeia/ and copy error.php file from there to your template folder.
Open 'error.php' and customize the HTML content. You can add:
- Friendly message like: "Oops! Page not found"
- Button to homepage;
- Search form;
- Links to popular pages;
- Contact information.
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 are a "website developer" and you 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 is having a real error you need to debug it. Go to {your-website}/templates/{your-template}/error.php and remove code from for 404 error page redirect which you added before.
If you prefer an easier, no-code approach, you can use extensions such as: Redirect managers, SEO tools, Error page builders. These tools allow you to manage 404 pages, redirects, and track broken links.
More about Joomla Errors show settings:


