Home » Magento19 August 2014

Magento: Redirect Customer to Previous Page After Login

By default, customers are redirected to ‘Customer Account Dashboard’ page after login. This feature can be easily changed from Magento configuration settings.

Configuration Settings

– Login to admin panel
– Go to System -> Configuration -> CUSTOMERS -> Customer Configuration -> Login Options
– Set: Redirect Customers to Account Dashboard after Loggin in = No
– You can see in comments for this field: Customer will stay on the current page if “No” is selected.

This setting will redirect customers to the page from where they have come to login page. This setting is applicable for all pages of your Magento website.

You might have another condition of having this feature only on some specific pages. For example, you might want this feature only on product view page. Or, you might have a category that is visible to logged in customers only. In this case, you can simply use the following code:

Redirect to customer login page

Show a login link for non-logged in customers

Customers will be redirected to previous page after successful login.

Hope it helps. Thanks.

Magento

Get New Post by Email

Find me on

FacebookTwitterGoogle+LinkedInRSS Feed
  • Harmeet

    Hi,

    Great Post!!

    It works straight a way however, on returning to previous URL after logging in, the url appends port 8080 after domain, which I believe web server port.

    how to redirect back to previous page without showing port 8080 in url?

    Thanks

  • harmeet

    There is another problem with the redirect: if username or password is wrong: it redirects to previous page. Ideally it should stay on the same login page with invalid user or password error.

  • Thanks Dear!!! this works fine for me :)

  • ND

    did you solve this problem