I using the following code to redirect all visitors to the login page. Everything is working fine with the exception of the Forgotten Password link... how would be make an exception for that /customer/account/forgotpassword/

$redirect_url = Mage::getUrl('customer/account/login/');
$current_url = Mage::helper('core/url')->getCurrentUrl();

    if ((!$this->helper('customer')->isLoggedIn()) && ($current_url != $redirect_url)) {
  • 1
    On the top of the page you can check the conditiona that if controller action name is not forgotpassword. This is the simplest way I can suggest. Jan 19, 2023 at 1:30
  • @AjayGehlod would it be something like this $this->getRequest()->getControllerName() = 'forgotpassword'
    – acctman
    Jan 20, 2023 at 21:24
  • 1
    forgotpassword is your action name not a controller name. Get an idea from here: magento.stackexchange.com/a/104639/73952 Jan 20, 2023 at 22:13


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.