I have an observer that is triggered when a user creates an account. In the execute method I have the following code:

public function execute(\Magento\Framework\Event\Observer $observer)
    $redirectionUrl = $this->url->getUrl('subscribe');

It does infact redirect as expected, but the user is not logged in after registration.

How can I redirect without having to use exit? If I remove exit the redirect doesn't happen.

  • Instead of exit just use return $this. May 12, 2021 at 4:31
  • Doing so causes the redirect to fail, and instead the user is redirected to their account page. This is not what I want. May 12, 2021 at 5:01
  • What is the event you are attaching this observer to?
    – Joao71
    May 12, 2021 at 10:29
  • customer_register_success May 13, 2021 at 0:41


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.