Tag Archives: joomla

Change default Joomla 404 behaviour or style

To show custom 404 page or redirect user on some error to home page or somewhere else copy file error.php located under /templates/system/ into youre template folder eg /templates/mytemplate/error.php.

For example to redirect user on 404 add these lines right after defined( ‘_JEXEC’ ) or die( ‘Restricted access’ );. This works for Joomla 1.5.

if ( $this->error->code == '404' )
{
	header('http://www.google.com');
	exit;
}

For Joomla 1.6 and 1.7 use

$this->error->getCode() == 404

Of course you can just change style and html of the same file. This is just example for the case you want to redirect user to another page and dont want them too see 404 at all or to add some other custom logic.