When we try a wrong URL in cakephp then it displays an error page with error message:
"Controller class could not be found".
We can override this message and also can handle this exception using Error.php of cake. We can override this function in our AppController using:
public function appError($error) {
// custom logic goes here.
}
If we want to redirect our user to Home page or some other page then this can be achieved by:
public function appError($error) {
$this->redirect('/');
}
I hope this will help someone. For more details click here.
0 Comment(s)