After Invalidate the cookie after 30 minutes without visiting In cakephp3.5.5

According to user type or controller how to redirect different page after inactivity logout or session time out?
i want to redirect page according to controller “after Invalidate the cookie after 30 minutes without visiting
i’m currently using
(in AppController)
if ($this->request->params[‘controller’] == “Pages”) {
$this->loadComponent(‘Auth’, [
‘loginRedirect’ => [‘controller’ => ‘Pages’, ‘action’ => ‘index’],
‘logoutRedirect’ => [‘controller’ => ‘Pages’, ‘action’ => ‘index’,]
]);
} else {
$this->loadComponent(‘Auth’, [
‘loginRedirect’ => [‘controller’ => ‘Users’, ‘action’ => ‘index’],
‘logoutRedirect’ => [‘controller’ => ‘Users’, ‘action’ => ‘index’,]
]);
}
This is not working