How can i redirect to the main page of the site when occure ERROR 404?
How can i redirect to the main page of the site when occure ERROR 404?
Whenever errors occur, the action error in siteController is called. you can customize the error route in that action, you can do something like this:
public function actionError() --in site controller
if(404==Yii::app()->errorHandler->error->code){
//go to custome error page
else
//code default error.php