Magento Admin Dashboard Redirecting Back to Login Page

Published by John on November 30, 2015 Under Magento

Recently, after moving a copy of a clients Magento site to my development server and changing the url, so that I could do some updates on their site, I was having trouble logging into the admin.

I manually updated the password, however after a successful login, I was immediately redirected back to the login page. It was clear that the login was correct, as I did not get the normal Invalid User Name or Password. error, it was just redirecting me back to the Magento login page.

In my case, this was due to the Cookie Domain needing to be updated to use the new url. To check, you can do the following query:

mysql> select * from core_config_data where path = 'web/cookie/cookie_domain';
+-----------+---------+----------+--------------------------+-----------------------+
| config_id | scope   | scope_id | path                     | value                 |
+-----------+---------+----------+--------------------------+-----------------------+
|       686 | default |        0 | web/cookie/cookie_domain | client.olddomain.com  |
+-----------+---------+----------+--------------------------+-----------------------+
1 row in set (0.00 sec)

As you can see from the above, the cookie domain is set to the old client’s website and so even with the correct username/password, the login would not work. It needs to be the same as the new url. If it is already correct, then you probably have some other issue.

To fix this, I preformed the following query and then manually cleared the Magento Cache…but first Backup your Magento Database and Files!

mysql> update core_config_data set value = 'client.newdomain.com' where path='web/cookie/cookie_domain' limit 1;

Manually clear Magento Cache:

[webuser@localhost newdomain]# rm -rf public_html/var/cache/*

After this, I was able to login. This is the first time I’ve run into this when moving a site, although this site does have a bit of a different setup than most I do, as it is installed into a subdirectory and on a sub domain.


No Comments |

Add a Comment