I am using Magento ver. The issue is customer login page not redirecting to account page.

Login.phtm code

<div class="account-login">
    <div class="page-title">
        <h1><?php echo $this->__('Login or Create an Account') ?></h1>
    <?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
    <form action="<?php echo $this->getPostActionUrl() ?>" method="post" id="login-form">
        <?php echo $this->getBlockHtml('formkey'); ?>
        <div class="row">
            <div class="col-sm-6 new-users">
                <div class="content">
                    <h2><?php echo $this->__('New Customers') ?></h2>
                    <p><?php echo $this->__('By creating an account with our store, you will be able to move through the checkout process faster, store multiple shipping addresses, view and track your orders in your account and more.') ?></p>
                <div class="buttons-set">
                    <button type="button" title="<?php echo $this->__('Create an Account') ?>" class="button" onclick="window.location='<?php echo Mage::helper('persistent')->getCreateAccountUrl($this->getCreateAccountUrl()) ?>';"><span><span><?php echo $this->__('Create an Account') ?></span></span></button>
            <div class="col-sm-6 registered-users">
                <div class="content">
                    <h2><?php echo $this->__('Registered Customers') ?></h2>
                    <p><?php echo $this->__('If you have an account with us, please log in.') ?></p>
                    <ul class="form-list">
                        <input type="hidden" name="form_key" value="<?php echo Mage::getSingleton('core/session')->getFormKey(); ?>" />
                            <label for="email" class="required"><em>*</em><?php echo $this->__('Email Address') ?></label>
                            <div class="input-box">
                                <input type="text" name="login[username]" value="<?php echo $this->escapeHtml($this->getUsername()) ?>" id="email" class="input-text required-entry validate-email" title="<?php echo $this->__('Email Address') ?>" />
                            <label for="pass" class="required"><em>*</em><?php echo $this->__('Password') ?></label>
                            <div class="input-box">
                                <input type="password" name="login[password]" class="input-text required-entry validate-password" id="pass" title="<?php echo $this->__('Password') ?>" />
                        <?php echo $this->getChildHtml('form.additional.info'); ?>
                        <?php echo $this->getChildHtml('persistent.remember.me'); ?>
                    <?php echo $this->getChildHtml('persistent.remember.me.tooltip'); ?>
                    <p class="required"><?php echo $this->__('* Required Fields') ?></p>
                <div class="buttons-set">
                    <a href="<?php echo $this->getForgotPasswordUrl() ?>" class="f-left"><?php echo $this->__('Forgot Your Password?') ?></a>
                    <button type="submit" class="button" title="<?php echo $this->__('Login') ?>" name="send" id="send2"><span><span><?php echo $this->__('Login') ?></span></span></button>
        <?php if (Mage::helper('checkout')->isContextCheckout()): ?>
            <input name="context" type="hidden" value="checkout" />
        <?php endif; ?>
    <script type="text/javascript">
        var dataForm = new VarienForm('login-form', true);

Cookie settings enter image description here

Please help I have tried cleaning cache multiple times, please help I am just redirected to the login page. There is no error message.

  • no error message mean form_key is invalid . You nee fix the form key_issue
    – Amit Bera
    Commented May 20, 2017 at 18:58
  • and how?? please explain Commented May 20, 2017 at 18:59
  • magento.stackexchange.com/questions/99407/…
    – Amit Bera
    Commented May 20, 2017 at 19:02
  • Can you please copy solution here? Commented May 20, 2017 at 19:05
  • Is this a redirection issue or you not able to set cookie/session? Commented Jul 30, 2019 at 18:49

2 Answers 2


Go to Admin > System > Configuration > Customer Configuration, under the Login Options set Redirect Customer to Account Dashboard after Logging in to Yes, Save and refresh your cache.


If it doesn't work for you, you can create un observer for this, controller_action_postdispatch_customer_account_loginPost

public function redirectCustomer($observer){
    $url = Mage::getBaseUrl().'acustomer/account';
    return $this;
  • that is yes already Commented May 21, 2017 at 12:32
  • I don't know why it doesn't work for you, look my update.
    – PЯINCƎ
    Commented May 21, 2017 at 16:55

Is this the redirection issue or you not able to set login session?

If the redirection issue then follow steps as @pЯincƏ suggesting.

Else proper cookie is not set.

Set cookie Path to /

set cookie domain to .example.com

Rest is OK.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.