Redirect to register page instead of login

Hi,

Is there to a way globally to redirect users that are visiting a page that needs to be logged in, to the register page instead of the login page?

or do i have to do it in every controller like this?

[   
    'actions' => ['index' ,'payment','checkout'],
     'allow' => true,
     'matchCallback' => function ($rule, $action) {
           if (Yii::$app->user->isGuest) {
              return $this->redirect(['/user/register'])->send();
           }
           return true;
      }
]

You can set on beforeAction in config file.