This is how to make a 404 redirect to index page in Joomla



if (($this->error->code) == '404') {
header('Location: /index.php');
exit;
}

Edit the error.php file as follows, adding the code below immediately :

Add this to your error.php file under the 'restricted access' line. The error.php file is located in template system folder to redirect to front page in Joomla.