Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8588613
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T22:50:49+00:00 2026-06-11T22:50:49+00:00

How to redirect after login to a particular page which depend upon the page

  • 0

How to redirect after login to a particular page which depend upon the page from which the login is clicked in magento? I know redirection haappens in AccountController.php. But how to get the link of page from where customer logged in.I have two different pages for login .

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T22:50:50+00:00Added an answer on June 11, 2026 at 10:50 pm

    This is actually pretty easy. All you have to do is insert next code somewhere on your pages from which you’re making Log In.

    Mage::getSingleton('customer/session')->setBeforeAuthUrl(Mage::getUrl('*/*/*'));
    

    What it does – it sets the variable to Customer session, that holds url of the referrer page. AccountController will send you back on that page after logging in, if the variable is set.

    UPDATE

    Just thought I may need to edit the post, since the info is not full. So as I’ve learned some time ago, there are actually 2 session keys that rule the logic of "returning back/redirecting" after logging in:

    • before_auth_url: this should be set to the page, you want your user to see, if his login/password haven’t passed the validation
    • after_auth_url: this is url you want your user to be redirected to after successful log in

    Now the solution above worked, because Magento automatically sets after_auth_url = before_auth_url if the former is not set.

    Here’s the quick example: you have login form on Checkout. So you want your users to be redirected back to Checkout after they’ve logged in. BUT you don’t want your users to be redirected back to checkout if they failed to enter valid credentials. Rather than that you want them to stay on Login page, so they have ability to request Forget Password email or Register anew. Once they are able to login, you want them to be back at Checkout.

    As complex as that use-case sounds, it’s actually quiet simple to achieve, and is’t already done in Magento Checkout. So here’s what you need to set:

    Mage::getSingleton('customer/session')
        ->setBeforeAuthUrl(Mage::getUrl('customer/account/login'));
    Mage::getSingleton('customer/session')->setAfterAuthUrl(Mage::getUrl('*/*/*'));
    

    That’s all folks 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I found many way for redirect to previous page after login and example :
What we need: redirect to each user's specific page after their login. What we
Which is the best method to implement role based redirect after login in FOSUserBundle
After i login using Facebook connect,I need to redirect user to particular URL.The below
I am new to grail and dont know how to redirect after ajax login
After login i use need to set up redirect to custom page. How to
I'm having an issue where after logging out, I redirect to my site's login
my problem is after i successfully log in,it is not redirect to page that
I need to do custom redirect after login, but i'm not very familiar with
I'm struggling to redirect a user after their login request to the server is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.