Magento Login Admin not work happen in many cases and this is a simple issue but it will take time if you don’t know how to fix it.

This article will show you all of cases we meet and update continually every time we have a new case.

Problem: Can’t access admin URL

After moving to a new hosting or after install a new extension with some new configuration or server changes. It can make your admin URL not work. It may show a blank page or simple show server error. Let’s check one of these solution

Solution 1: Check and make sure mode rewrite enabled, unless you will see the blank page. To check this mod_rewrite enabled or not, let’s call php function:

phpinfo();

And then check the result to see mod_rewrite in “Loaded Modules” and try to enable it if not.

Solution 2: Maybe the caching is still there, so let’s clear all cache in folder “var/cache” or if you are using some special cache let’s check https://magento2x.com/clearflush-redis-cache-memcached-data/

Problem: Blank page after submit login information

This problem happen because the wrong URL/domain configuration in database. After moving to new domain or somehow database change to the wrong configuration. Let’s correct it.

Login to database phpmyadmin or any database tool to execute this SQL command

UPDATE core_config_data SET value = ‘new_domain’ where path = ‘web/cookie/cookie_domain’;

or simple delete all of them and magento will reconfiguration auto:

DELETE * FROM <code>core_config_data</code> WHERE <code>path</code> = &quot;web/cookie/cookie_domain&quot;
DELETE * FROM <code>core_config_data</code> WHERE <code>path</code> LIKE &quot;web/secure/base%&quot;
DELETE * FROM <code>core_config_data</code> WHERE <code>path</code> LIKE &quot;web/unsecure/base%&quot;

Now, let’s clear all cache files and try again.

After doing these steps but it still not work then let’s go with extra steps:

#1 Check cookie expiration

Having been set, the cookie’s instantly expiring. To check it start with the cookies your browser contains and if there’s one from Magento.

setcookie (
"CookieName",
"CookieValue",
time (+ (10* 365* 24* 60* 60)
) ;

The local time could have been set incorrectly. You can check backend settings made by your admin users in Magento admin logs (when installed). This being so, the both timezones applied by Magento should be reviewed. The cookie specification can be set to expire in 10+ years.

#2 Shift to the localhost interface

Being set to run locally the Apache webserver may be accessed through the localhost (hostname). Thus, the cookie won’t be set due to security configs of the browser. Stop using localhost, but run the localhost interface instead. You need either to shift the base url_values in core_config_data table or to look at your interface configuration. Then delete your contents and reload the page.

#3 Prove the cookie domain matches the server’s

Go to the core_config_data table via the SQL command and renew it to a less secure -> empty string or a safer -> actual domain:

System-&gt; Configuration-&gt; Web -&gt; Session Cookie Management

#4 Confirm ‘getBlockHtml’ is there

‘Formkeys’ or getBlockHtml is used for protecting Magento against XSS attacks. It’s saved in the session data and validated during the submission to the server.

If something is wrong about it the action won’t be completed.

#5 Review core file

Other team developers could have customized app\code\core\Mage\Core\Model\Session\Abstract\Varien.php:

/* to solve login issue */
/*if (!$cookieParams[ 'httponly']) {
unset (!$cookieParams[ 'httponly']);
if (!$cookieParams[ 'secure']) {
unset (!$cookieParams [ 'secure']);
if (!$cookieParams[ 'domain']) {
unset (!$cookieParams[ 'domain']);
}
}
}
if (isset ($cookieParams ['domain'])) {
$cookieParams ['domain'] = $cookie-&gt;getDomain();*/ //I have commented these lines

Thus, bugs tracking and login work could have been affected.

References:

https://amasty.com/knowledge-base/magento-login-not-working-5-ways-to-decide-what-to-do-next

https://community.magento.com/t5/Installing-Magento-1-x/Can-t-login-into-admin-area/td-p/2196

https://www.simicart.com/blog/magento-admin-login-not-working/

https://www.yireo.com/tutorials/magento/magento-administration/651-unable-to-login-into-the-magento-backend

Leave a Reply