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 6719371
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T09:05:07+00:00 2026-05-26T09:05:07+00:00

I have the following controller action, which redirects to the login page if no

  • 0

I have the following controller action, which redirects to the login page if no user is logged in:

public function requireloginAction() {
  if(!Mage::getSingleton('customer/session')->isLoggedIn()) {  
    // Not logged in
    // Save requested URL for later redirection
    Mage::getSingleton('customer/session')->setBeforeAuthUrl($this->getRequest()->getRequestUri());
    header("Status: 301");
    header('Location: '.Mage::helper('customer')->getLoginUrl());  // send to the login page
  }
  else {
    // Logged in
    .. do something ..
  }
}

By using setBeforeAuthUrl, once the user logs in he/she is redirected back to this action.

Problem:

If instead of logging in, the user, creates an account he/she is then redirected to the main page, rather then to the url set in setBeforeAuthUrl.

Question:

Is there something similar to setBeforeAuthUrl that works with Account Creation too? Or how can I achieve the desired effect?

(Magento Version 1.6)

  • 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-05-26T09:05:07+00:00Added an answer on May 26, 2026 at 9:05 am

    Found solution.

    First of all, setBeforeAuthUrl($url) does work for both “Log In” and “New Account Creation”!

    The main difference (and the reason I had the problem) is that for a “New Account Creation” Magento checks if $url is within the domain name of the current store and if it is not, it redirects to the “My Account” page. While the redirection for “Log In” redirects to any $url.

    I do not know if this is a bug or a feature (I’m using V1.6.0.0).

    So just make sure to redirect to a url within the domain name of the current store – especially in a Multi Store configuration.

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

Sidebar

Related Questions

I have the following controller action: [HttpGet] public JsonpResult getTestValues(int? entityId, int? id) {
I have the following route: {language}/{controller}.mvc/{action}/{id} Once a user has choosen the language it
I have the following code in my controller action method: if (User.Identity.IsAuthenticated) { //
I have a controller with the following action code: public JsonResult CheckPasswordStrength(string password, string
I have the following controller: class Tests extends CI_Controller { public function update_record_test() {
I have the following method which allows a user to login into my application:
I have the following: /api/users(controller: user) { action = [GET:list] } Doing a call
I have the following route: routes.MapRoute( Default, // Route name {controller}/{action}/{id}, // URL with
If i have a controller action Create that returns a view with the following
I have the following code in my gsp <select onChange=${remoteFunction(action:'superior', controller:'employee', params: '\'name=\' +

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.