Is there a way or a function within a controller that tells if a 404 error was triggered? I would like everyone to redirect at the homepage instead of seeing a 404 page.
The simple way is to put this in your app/Config/core.php
Configure::write('Exception.handler', function ($error) { header('Location: https://www.example.com'); });
Please note that anonymous functions as callback are supported by PHP v5.3+