Default Error Page for whole project

Hi guys

i want to know a simple thing that if its possible to create default error page for whole project

Like on any of the pages in the project if script break than i want to display custom error page instead of that

big scary red and yellow error screen to user

So is it possible or i have to handle error on each controller manually???

Add and modify this key in your configuration:




return [

    'components' => [

        'errorHandler' => [

            'errorAction' => // url of error action here

        ],

    ],

];



That works perfect

Thank you very much

hey,

if i use this solution, for every type of error i get redirected to same page (page not found(404) , permission error(403)). ie, if a user comes across a 404 he get redirected to a page lets say ‘X’ and if the same user comes across 403 he would get redirected to ‘X’ itself isn’t it?

if so how can i handle different types of error?

You can check the type of error in your action and handle it from there.