How to redirect customers to a custom page when they go to any other page.

I have set Redirect Customer to Account Dashboard after Logging in to the store configuration but it is not working.

2 Answers 2


It is controlled in


if (!empty($login['username']) && !empty($login['password'])) {
    try {
        $customer = $this->customerAccountManagement->authenticate($login['username'], $login['password']);
        if ($this->getCookieManager()->getCookie('mage-cache-sessid')) {
            $metadata = $this->getCookieMetadataFactory()->createCookieMetadata();
            $this->getCookieManager()->deleteCookie('mage-cache-sessid', $metadata);
        $redirectUrl = $this->accountRedirect->getRedirectCookie();
        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;

By default, Magento will read the getRedirectCookie() and take out the URL before login, and then redirect back to this URL after logging in.

You can either override this controller or get the instance of \Magento\Customer\Model\Account\Redirect and use


Remember store configuration "Redirect Customer to Account Dashboard after Logging in" must be set to No, otherwise it will default goes to a dashboard


If you want to redirect the Customer to the account dashboard after login.

  1. Log in to Admin Panel
  2. Go to Stores > Configuration
  3. Under Customers, select Customer Configuration
  4. Expand the Login Options
  5. Set “Redirect Customer to Account Dashboard after Logging in” to Yes.
  6. Save configuration. enter image description here

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.