2.14.2.17. Configure 404 page in Joomla!
You can configure 404 page by redirecting to a page created:
Automatically
Create 404 page in CMS
- Open the "Materials → Material manager → Create material" section:

- Specify the data for creating the desired 404 page:

- "Title" is an arbitrary page title.
- "Material" is the text that needs to be displayed on the page.
- "Status" — "Published" (otherwise it will be impossible to access the page).
- "Category" — the required category (for example, "Uncategorised").
- "Access" — "Public" to allow access for all website visitors. Otherwise, they will not be able to reach the 404 page, and browser will display an infinite redirect error page.
- Switch to the "Display" tab and hide unnecessary elements of this page:
As a rule, it is best to hide the following elements:- "Show labels".
- "Introductory text".
- "Material information title".
- "Category".
- "Category as link".
- "Parent category title".
- "Parent category title as a link".
- "Show associations".
- "Author".
- "Publication date".
- "Navigation".
- "Show icons".
- "Print icon".
- "Number of views".
- Save the page by clicking "Save".
- As soon as page is refreshed and data is saved, pay attention to browser address bar and remember the page number specified after
&id=X:
- Configure redirection to this page by specifying string
/index.php?option=com_content&view=article&id=Xas theaddress_of_the_created_page, where instead ofXyou should specify previously saved page number.
Manually
Create custom 404 page manually
To create your own 404 page (without using a Joomla! template), create such a page, for example, in the root directory of the site with a name like 404-error.php, using your own layout with the required information and visual design, or by using third-party templates, for example this one.
After creating the page itself, configure redirection to it by specifying the file name as the created_page_address, for example, with the previously given example /404-error.php.
Configure 404 error redirect
By default, the 404 error is generated using the error.php file in the theme directory, but in most cases these files have a rather complex structure that ensures correct operation specifically with this theme.
- Rename the
error.phpfile of the active theme to another arbitrary name, for exampleerror.php.bak. - Copy the
templates/system/error.phpfile to the active theme directory. - Edit the file by specifying the redirect lines:
if (($this->error->getCode()) == '404') { header('Location: /created_page_address'); exit; }after the lines
if (!isset($this->error)) { $this->error = JError::raiseWarning(404, JText::_('JERROR_ALERTNOAUTHOR')); $this->debug = false; } $app = JFactory::getApplication();Instead of
/address_of_the_created_page, specify required address of previously created page.
You can perform all the specified actions using the file manager or any FTP client.