Prevent Redirect to My Account After Login


To prevent the user from being redirected back to the My Account page during login on Magento 2, and to let them stay on the same page they were on before logging in:

  1. Navigate to Stores -> Configuration -> Customers -> Customer Configuration -> Login Options.
  2. Disable the "Redirect Customer to Account Dashboard after Logging in" setting.