How Magento redirect the customer to account login controller form the account index controller?

2 Answers 2


In this case, you should check Magento\Customer\Controller\Plugin\Account and check the beforeDispatch() method.


This is the code which is responsible for redirecting the customer to the specified location after successful login.

    if (!$this->getScopeConfig()->getValue('customer/startup/redirect_dashboard') && $redirectUrl) {
         $resultRedirect = $this->resultRedirectFactory->create();
         // URL is checked to be internal in $this->_redirect->success()
         return $resultRedirect;

You can find the details in execute method in file vendor/magento/module-customer/Controller/Account/LoginPost.php

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.