cancel
Showing results for 
Search instead for 
Did you mean: 

Magento 1.9 customer/account/login/ not working

Magento 1.9 customer/account/login/ not working

No idea why suddenly the customer/account/login/ page keeps redirecting to the same current login page, even if I input wrong account info I can't get any error info.

 

The Ajax popup login form works well. But sometimes it fails to popup while clicking the login button and the page will be directed to customer/account/login/

 

I've added the following codes to the customer login page but still doesn't work

<input name="form_key" type="hidden" value="<?php echo Mage::getSingleton('core/session')->getFormKey() ?>" />

 

And occasionally I found that if I set System→Configuaration→GENERAL→Web→Search Engines Optimization→Use Web Server Rewrites to NO, the login page will work but we need these url rewrites.

 

I attached the .htaccess file as below, and all url rewrites are just related to the products link.

############################################
## uncomment these lines for CGI mode
## make sure to specify the correct cgi php binary file name
## it might be /cgi-bin/php-cgi

#    Action php5-cgi /cgi-bin/php5-cgi
#    AddHandler php5-cgi .php

############################################
## GoDaddy specific options

#   Options -MultiViews

## you might also need to add this line to php.ini
##     cgi.fix_pathinfo = 1
## if it still doesn't work, rename php.ini to php5.ini

############################################
## this line is specific for 1and1 hosting

    #AddType x-mapp-php5 .php
    #AddHandler x-mapp-php5 .php

############################################
## default index file

    DirectoryIndex index.php

<IfModule mod_php5.c>

############################################
## adjust memory limit

    php_value memory_limit 512M
    php_value max_execution_time 18000

############################################
## disable magic quotes for php request vars

    php_flag magic_quotes_gpc off

############################################
## disable automatic session start
## before autoload was initialized

    php_flag session.auto_start off

############################################
## enable resulting html compression

    #php_flag zlib.output_compression on

###########################################
# disable user agent verification to not break multiple image upload

    php_flag suhosin.session.cryptua off

###########################################
# turn off compatibility with PHP4 when dealing with objects

    php_flag zend.ze1_compatibility_mode Off

</IfModule>

<IfModule mod_security.c>
###########################################
# disable POST processing to not break multiple image upload

    SecFilterEngine Off
    SecFilterScanPOST Off
</IfModule>

<IfModule mod_deflate.c>

############################################
## enable apache served files compression
## http://developer.yahoo.com/performance/rules.html#gzip

    # Insert filter on all content
    ###SetOutputFilter DEFLATE
    # Insert filter on selected content types only
    #AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript

    # Netscape 4.x has some problems...
    #BrowserMatch ^Mozilla/4 gzip-only-text/html

    # Netscape 4.06-4.08 have some more problems
    #BrowserMatch ^Mozilla/4\.0[678] no-gzip

    # MSIE masquerades as Netscape, but it is fine
    #BrowserMatch \bMSIE !no-gzip !gzip-only-text/html

    # Don't compress images
    #SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip dont-vary

    # Make sure proxies don't deliver the wrong content
    #Header append Vary User-Agent env=!dont-vary

</IfModule>

<IfModule mod_ssl.c>

############################################
## make HTTPS env vars available for CGI mode

    SSLOptions StdEnvVars

</IfModule>

<IfModule mod_rewrite.c>

############################################
## enable rewrites

    Options +FollowSymLinks
    RewriteEngine on

############################################
## you can put here your magento root folder
## path relative to web root

    #RewriteBase /magento/

############################################
## workaround for HTTP authorization
## in CGI environment

    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

<IfModule mod_setenvif.c>
    <IfModule mod_headers.c>

        ############################################
        # X-Content-Type-Options: nosniff disable content-type sniffing on some browsers.
        Header set X-Content-Type-Options: nosniff

        ############################################
        # This header forces to enables the Cross-site scripting (XSS) filter in browsers (if disabled)
        BrowserMatch \bMSIE\s8 ie8
        Header set X-XSS-Protection: "1; mode=block" env=!ie8

    </IfModule>
</IfModule>

############################################
## force slash in end of url except if it had .html extension
    RewriteCond %{REQUEST_URI} !(/$|\.)
    RewriteRule (.*) %{REQUEST_URI}/ [R=301,L]

############################################
## force https for all urls
    #RewriteCond %{HTTPS} off
    #RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

############################################
## always send 404 on missing files in these folders

    RewriteCond %{REQUEST_URI} !^/(media|skin|js)/

############################################
## never rewrite for existing files, directories and links

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-l

############################################
## rewrite everything else to index.php

    RewriteRule .* index.php [L]

</IfModule>


############################################
## Prevent character encoding issues from server overrides
## If you still have problems, use the second line instead

    AddDefaultCharset Off
    #AddDefaultCharset UTF-8

<IfModule mod_expires.c>

############################################
## Add default Expires header
## http://developer.yahoo.com/performance/rules.html#expires

    #ExpiresDefault "access plus 1 year"

</IfModule>

## EXPIRES CACHING ##
<IfModule mod_expires.c>
	ExpiresActive On
	ExpiresByType image/jpg "access plus 1 year"
	ExpiresByType image/jpeg "access plus 1 year"
	ExpiresByType image/gif "access plus 1 year"
	ExpiresByType image/png "access plus 1 year"
	ExpiresByType text/css "access plus 1 month"
	ExpiresByType application/pdf "access plus 1 month"
	ExpiresByType text/x-javascript "access plus 1 month"
	ExpiresByType application/x-javascript "access plus 1 month"
	ExpiresByType text/javascript "access plus 1 month"
	ExpiresByType application/javascript "access plus 1 month"
	ExpiresByType application/x-shockwave-flash "access plus 1 month"
	ExpiresByType image/x-icon "access plus 1 year"
	ExpiresDefault "access plus 2 days"
</IfModule>
## EXPIRES CACHING ##


############################################
## By default allow all access

    Order allow,deny
    Allow from all

############################################
## If running in cluster environment, uncomment this
## http://developer.yahoo.com/performance/rules.html#etags

    #FileETag none

###########################################
## Deny access to cron.php
    <Files cron.php>

############################################
## uncomment next lines to enable cron access with base HTTP authorization
## http://httpd.apache.org/docs/2.2/howto/auth.html
##
## Warning: .htpasswd file should be placed somewhere not accessible from the web.
## This is so that folks cannot download the password file.
## For example, if your documents are served out of /usr/local/apache/htdocs
## you might want to put the password file(s) in /usr/local/apache/.

        #AuthName "Cron auth"
        #AuthUserFile ../.htpasswd
        #AuthType basic
        #Require valid-user

############################################

        Order allow,deny
        Deny from all

    </Files>

# php -- BEGIN cPanel-generated handler, do not edit
# NOTE this account's php is controlled via FPM and the vhost, this is a place holder.
# Do not edit. This next line is to support the cPanel php wrapper (php_cli).
# AddType application/x-httpd-ea-php56 .php .phtml
# php -- END cPanel-generated handler, do not edit

Redirect 301 /zh/base_shadow.php /base_shadow.php
Redirect 301 /english/base_shadow.php /base_shadow.php

I want to make sure the Ajax login form always popup or the customer/account/login/ be able to work but no idea now.. Can anyone help? Thanks!

14 REPLIES 14

Re: Magento 1.9 customer/account/login/ not working

Hello @emily_cheng,

 

There may be several reasons like Magento upgrade, server change, from key error or cookie issue but in most of the cases, this situation is happening due to cookie problem or form key problem.

  1. Firstly, you need to check if form key has been passed properly or not? If it’s not, add following code at app\design\frontend\Themes\Yourtheme\template\persistent\customer\form\login.phtml
    <?php echo $this->getBlockHtml('formkey')?>
  2. If the form key is properly passed and still you are unable to login, you have to change cookie lifespan. Generally, default Magento cookie lifespan is set to 3600 (1 hour). Because the server timings of user’s computer and Magento cookie lifespan does not match always, to resolve this issue, you need to set the cookie lifetime to 86400 (1 day) through the Magento admin and your issue will be resolved.
    Go to Magento backend -> System -> Configuration -> Web -> Session and Cookie Management and Set cookie lifetime to 86400 and save. Everything will work as expected now.
    cookie-lifespan-setting.png
  3. After trying both the solutions above, if you still face an issue, you need to set cookie domain along with dot at the start of the domain and your login will again start working like a charm.

--
If my answers is useful, please give Kudos or Accept as Solution

Re: Magento 1.9 customer/account/login/ not working

Hi @gelanivishal,

 

Thank you very much for your reply!

 

Unfortunately, I've tried all of these ways before and none of them worked. 

 

And I use this module: youama.com/ajax-login-and-register-magento. While disabling the jQuery library on its setting page, the login form will always pop up as I want but I have my own jQuery files. Maybe it's jQuery files conflict sometimes? Not sure as I'm new to Magento...

Re: Magento 1.9 customer/account/login/ not working

Hello ,

still i am facing the same issue. I have commented the varient.php session code which is mostly told in any search.Please let me know the exact reason. Now i have set 86400 i.e. 24 hrs.

 

Still no success for login with chrome only...Other browsers login easily.

Re: Magento 1.9 customer/account/login/ not working

 What was the problem really? I'm sure it was this code

<input name="form_key" type="hidden" value="<?php echo Mage::getSingleton('core/session')->getFormKey() ?>" />

 

Re: Magento 1.9 customer/account/login/ not working

It is great and good website https://lucky-patchers.net/

Re: Magento 1.9 customer/account/login/ not working

It is really amazing https://honistaapk.me/

Re: Magento 1.9 customer/account/login/ not working

Re: Magento 1.9 customer/account/login/ not working

If the login page at customer/account/login/ is not working, try the following steps:

  1. Clear Cache: Clear your browser cache and cookies, then try again.
  2. Different Browser: Use a different web browser to see if the issue persists.
  3. Check URL: Ensure the URL is correct and complete. like as <a href="https://fire-kirin.us">Fire Kirin</a>
  4. Disable Extensions: Disable any browser extensions that might be interfering.
  5. Contact Support: If the issue continues, reach out to the website's customer support for assistance.

If you need more detailed troubleshooting steps, feel free to provide additional information.

Re: Magento 1.9 customer/account/login/ not working

nice