This given PHP example redirect to index page if there is 404 error in your site.
Create the file app/app_error.php with the following code. Code Example: class AppError extends ErrorHandler { function error404($params) { // redirect to homepage $this->controller->redirect('/'); } }