cancel
Showing results for 
Search instead for 
Did you mean: 

Magento Admin redirecting to 404

SOLVED

Magento Admin redirecting to 404

Hi,

I have created a ACL rule from admin and by mistake saved a rule with all resources.
Then admin getting no authorization message and nothing to access.

So i go through the database and removed some rows from authorization_rule table except administrators row id 1 , then admin is not opening and redirecting to 404 page

localhost/magento/admin

redirects to

localhost/magento/key/fd510876c9092ddecc92bbd83aa0a6a984375e94ccf4489d9ac84665f95abe30/

A 404 page ....

 

Please suggest a solution...

1 ACCEPTED SOLUTION

Accepted Solutions

Re: Magento Admin redirecting to 404

Hi @Binod Yadav 

As per your suggestion i removed admin_user_session records and run all the commands
After that i was getting the following error:

{"0":"Could not create an acl object: Parent Role id '2' does not exist","1":"<pre>#1 Magento\\Framework\\Acl\\Builder\\Proxy->getAcl() called at [vendor\/magento\/module-backend\/Model\/Auth\/Session.php:229]\n#2 Magento\\Backend\\Model\\Auth\\Session->processLogin() called at [vendor\/magento\/module-backend\/Model\/Auth.php:165]\n#3 Magento\\Backend\\Model\\Auth->login('admin', 'Admin@123') called at [vendor\/magento\/framework\/Interception\/Interceptor.php:58]\n#4 Magento\\Backend\\Model\\Auth\\Interceptor->___callParent('login', array('admin', 'Admin@123')) called at [vendor\/magento\/framework\/Interception\/Interceptor.php:138]\n#5 Magento\\Backend\\Model\\Auth\\Interceptor->Magento\\Framework\\Interception\\{closure}('admin', 'Admin@123') called at [vendor\/magento\/framework\/Interception\/Interceptor.php:153]\n#6 Magento\\Backend\\Model\\Auth\\Interceptor->___callPlugins('login', array('admin', 'Admin@123'), array(array('security_admin_s...'))) called at [generated\/code\/Magento\/Backend\/Model\/Auth\/Interceptor.php:26]\n#7 Magento\\Backend\\Model\\Auth\\Interceptor->login('admin', 'Admin@123') called at [vendor\/magento\/module-backend\/App\/Action\/Plugin\/Authentication.php:205]\n#8 Magento\\Backend\\App\\Action\\Plugin\\Authentication->_performLogin(&Magento\\Framework\\App\\Request\\Http#0000000050193b07000000000a298fc1#) called at [vendor\/magento\/module-backend\/App\/Action\/Plugin\/Authentication.php:157]\n#9 Magento\\Backend\\App\\Action\\Plugin\\Authentication->_processNotLoggedInUser(&Magento\\Framework\\App\\Request\\Http#0000000050193b07000000000a298fc1#) called at [vendor\/magento\/module-backend\/App\/Action\/Plugin\/Authentication.php:125]\n#10 Magento\\Backend\\App\\Action\\Plugin\\Authentication->aroundDispatch(&Magento\\Backend\\Controller\\Adminhtml\\Index\\Index\\Interceptor#000000005019390a000000000a298fc1#, &Closure#0000000050193908000000000a298fc1#, &Magento\\Framework\\App\\Request\\Http#0000000050193b07000000000a298fc1#) called at [vendor\/magento\/framework\/Interception\/Interceptor.php:135]\n#11 Magento\\Backend\\Controller\\Adminhtml\\Index\\Index\\Interceptor->Magento\\Framework\\Interception\\{closure}(&Magento\\Framework\\App\\Request\\Http#0000000050193b07000000000a298fc1#) called at [vendor\/magento\/framework\/Interception\/Interceptor.php:153]\n#12 Magento\\Backend\\Controller\\Adminhtml\\Index\\Index\\Interceptor->___callPlugins('dispatch', array(&Magento\\Framework\\App\\Request\\Http#0000000050193b07000000000a298fc1#), NULL) called at [generated\/code\/Magento\/Backend\/Controller\/Adminhtml\/Index\/Index\/Interceptor.php:26]\n#13 Magento\\Backend\\Controller\\Adminhtml\\Index\\Index\\Interceptor->dispatch(&Magento\\Framework\\App\\Request\\Http#0000000050193b07000000000a298fc1#) called at [vendor\/magento\/framework\/App\/FrontController.php:159]\n#14 Magento\\Framework\\App\\FrontController->processRequest(&Magento\\Framework\\App\\Request\\Http#0000000050193b07000000000a298fc1#, &Magento\\Backend\\Controller\\Adminhtml\\Index\\Index\\Interceptor#000000005019390a000000000a298fc1#) called at [vendor\/magento\/framework\/App\/FrontController.php:98]\n#15 Magento\\Framework\\App\\FrontController->dispatch(&Magento\\Framework\\App\\Request\\Http#0000000050193b07000000000a298fc1#) called at [vendor\/magento\/framework\/Interception\/Interceptor.php:58]\n#16 Magento\\Framework\\App\\FrontController\\Interceptor->___callParent('dispatch', array(&Magento\\Framework\\App\\Request\\Http#0000000050193b07000000000a298fc1#)) called at [vendor\/magento\/framework\/Interception\/Interceptor.php:138]\n#17 Magento\\Framework\\App\\FrontController\\Interceptor->Magento\\Framework\\Interception\\{closure}(&Magento\\Framework\\App\\Request\\Http#0000000050193b07000000000a298fc1#) called at [vendor\/magento\/framework\/Interception\/Interceptor.php:153]\n#18 Magento\\Framework\\App\\FrontController\\Interceptor->___callPlugins('dispatch', array(&Magento\\Framework\\App\\Request\\Http#0000000050193b07000000000a298fc1#), array(array('default_store_se...', 'page_cache_from_...', 'storeCookieValid...', 'install', 'configHash'))) called at [generated\/code\/Magento\/Framework\/App\/FrontController\/Interceptor.php:26]\n#19 Magento\\Framework\\App\\FrontController\\Interceptor->dispatch(&Magento\\Framework\\App\\Request\\Http#0000000050193b07000000000a298fc1#) called at [vendor\/magento\/framework\/App\/Http.php:137]\n#20 Magento\\Framework\\App\\Http->launch() called at [vendor\/magento\/framework\/App\/Bootstrap.php:261]\n#21 Magento\\Framework\\App\\Bootstrap->run(&Magento\\Framework\\App\\Http\\Interceptor#0000000050193be3000000000a298fc1#) called at [index.php:40]\n<\/pre>","url":"\/magentonew\/admin\/admin\/index\/index\/key\/ae9f0d0cf56aa0f1cbcfdbbfe5ad07727e8a958d6926356e4c3d2827fc56abab\/","script_name":"\/magentonew\/index.php"}

So i changed the parent id from 2 to 1 and role id from 3 to 2
Now my authorization_role table looks like below:
90.0.0.69   localhost   magento233   authorization_role   phpMyAdmin 4.5.4.1deb2ubuntu2.1.png
And running the below commands

php bin/magento setup:upgrade
php bin/magento setup:di:compile
php bin/magento indexer:reindex
php bin/magento cache:flush
php bin/magento setup:static-content:deploy -f
chmod -R 777 var/ pub/ generated/

It was working......

View solution in original post

5 REPLIES 5

Re: Magento Admin redirecting to 404

Hello @Kiran 

 

Honestly, I am a bit confused about the problem you are facing.

Were you doing something from the user roll part of default Magento or you are doing ACL stuff in a custom extension?

If the user roll thing, then you can create a new admin user from CLI.

 

 

Was my answer helpful? You can accept it as a solution.
175+ Professional Extensions for M1 & M2
Need a developer?Just visit Contact Us Now

Re: Magento Admin redirecting to 404

Yes I created admin user from command line still iam getting the same
issue...

Re: Magento Admin redirecting to 404

Hello @Kiran ,

 

You can remove the user session from admin_user_session table in database.
Also remove the cache through Command.

php bin/magento setup:upgrade

rm -rf var/cache/*

rm -rf var/generation/*

If my answer is useful, please Accept as Solution & give Kudos

Re: Magento Admin redirecting to 404

Hi @Binod Yadav 

As per your suggestion i removed admin_user_session records and run all the commands
After that i was getting the following error:

{"0":"Could not create an acl object: Parent Role id '2' does not exist","1":"<pre>#1 Magento\\Framework\\Acl\\Builder\\Proxy->getAcl() called at [vendor\/magento\/module-backend\/Model\/Auth\/Session.php:229]\n#2 Magento\\Backend\\Model\\Auth\\Session->processLogin() called at [vendor\/magento\/module-backend\/Model\/Auth.php:165]\n#3 Magento\\Backend\\Model\\Auth->login('admin', 'Admin@123') called at [vendor\/magento\/framework\/Interception\/Interceptor.php:58]\n#4 Magento\\Backend\\Model\\Auth\\Interceptor->___callParent('login', array('admin', 'Admin@123')) called at [vendor\/magento\/framework\/Interception\/Interceptor.php:138]\n#5 Magento\\Backend\\Model\\Auth\\Interceptor->Magento\\Framework\\Interception\\{closure}('admin', 'Admin@123') called at [vendor\/magento\/framework\/Interception\/Interceptor.php:153]\n#6 Magento\\Backend\\Model\\Auth\\Interceptor->___callPlugins('login', array('admin', 'Admin@123'), array(array('security_admin_s...'))) called at [generated\/code\/Magento\/Backend\/Model\/Auth\/Interceptor.php:26]\n#7 Magento\\Backend\\Model\\Auth\\Interceptor->login('admin', 'Admin@123') called at [vendor\/magento\/module-backend\/App\/Action\/Plugin\/Authentication.php:205]\n#8 Magento\\Backend\\App\\Action\\Plugin\\Authentication->_performLogin(&Magento\\Framework\\App\\Request\\Http#0000000050193b07000000000a298fc1#) called at [vendor\/magento\/module-backend\/App\/Action\/Plugin\/Authentication.php:157]\n#9 Magento\\Backend\\App\\Action\\Plugin\\Authentication->_processNotLoggedInUser(&Magento\\Framework\\App\\Request\\Http#0000000050193b07000000000a298fc1#) called at [vendor\/magento\/module-backend\/App\/Action\/Plugin\/Authentication.php:125]\n#10 Magento\\Backend\\App\\Action\\Plugin\\Authentication->aroundDispatch(&Magento\\Backend\\Controller\\Adminhtml\\Index\\Index\\Interceptor#000000005019390a000000000a298fc1#, &Closure#0000000050193908000000000a298fc1#, &Magento\\Framework\\App\\Request\\Http#0000000050193b07000000000a298fc1#) called at [vendor\/magento\/framework\/Interception\/Interceptor.php:135]\n#11 Magento\\Backend\\Controller\\Adminhtml\\Index\\Index\\Interceptor->Magento\\Framework\\Interception\\{closure}(&Magento\\Framework\\App\\Request\\Http#0000000050193b07000000000a298fc1#) called at [vendor\/magento\/framework\/Interception\/Interceptor.php:153]\n#12 Magento\\Backend\\Controller\\Adminhtml\\Index\\Index\\Interceptor->___callPlugins('dispatch', array(&Magento\\Framework\\App\\Request\\Http#0000000050193b07000000000a298fc1#), NULL) called at [generated\/code\/Magento\/Backend\/Controller\/Adminhtml\/Index\/Index\/Interceptor.php:26]\n#13 Magento\\Backend\\Controller\\Adminhtml\\Index\\Index\\Interceptor->dispatch(&Magento\\Framework\\App\\Request\\Http#0000000050193b07000000000a298fc1#) called at [vendor\/magento\/framework\/App\/FrontController.php:159]\n#14 Magento\\Framework\\App\\FrontController->processRequest(&Magento\\Framework\\App\\Request\\Http#0000000050193b07000000000a298fc1#, &Magento\\Backend\\Controller\\Adminhtml\\Index\\Index\\Interceptor#000000005019390a000000000a298fc1#) called at [vendor\/magento\/framework\/App\/FrontController.php:98]\n#15 Magento\\Framework\\App\\FrontController->dispatch(&Magento\\Framework\\App\\Request\\Http#0000000050193b07000000000a298fc1#) called at [vendor\/magento\/framework\/Interception\/Interceptor.php:58]\n#16 Magento\\Framework\\App\\FrontController\\Interceptor->___callParent('dispatch', array(&Magento\\Framework\\App\\Request\\Http#0000000050193b07000000000a298fc1#)) called at [vendor\/magento\/framework\/Interception\/Interceptor.php:138]\n#17 Magento\\Framework\\App\\FrontController\\Interceptor->Magento\\Framework\\Interception\\{closure}(&Magento\\Framework\\App\\Request\\Http#0000000050193b07000000000a298fc1#) called at [vendor\/magento\/framework\/Interception\/Interceptor.php:153]\n#18 Magento\\Framework\\App\\FrontController\\Interceptor->___callPlugins('dispatch', array(&Magento\\Framework\\App\\Request\\Http#0000000050193b07000000000a298fc1#), array(array('default_store_se...', 'page_cache_from_...', 'storeCookieValid...', 'install', 'configHash'))) called at [generated\/code\/Magento\/Framework\/App\/FrontController\/Interceptor.php:26]\n#19 Magento\\Framework\\App\\FrontController\\Interceptor->dispatch(&Magento\\Framework\\App\\Request\\Http#0000000050193b07000000000a298fc1#) called at [vendor\/magento\/framework\/App\/Http.php:137]\n#20 Magento\\Framework\\App\\Http->launch() called at [vendor\/magento\/framework\/App\/Bootstrap.php:261]\n#21 Magento\\Framework\\App\\Bootstrap->run(&Magento\\Framework\\App\\Http\\Interceptor#0000000050193be3000000000a298fc1#) called at [index.php:40]\n<\/pre>","url":"\/magentonew\/admin\/admin\/index\/index\/key\/ae9f0d0cf56aa0f1cbcfdbbfe5ad07727e8a958d6926356e4c3d2827fc56abab\/","script_name":"\/magentonew\/index.php"}

So i changed the parent id from 2 to 1 and role id from 3 to 2
Now my authorization_role table looks like below:
90.0.0.69   localhost   magento233   authorization_role   phpMyAdmin 4.5.4.1deb2ubuntu2.1.png
And running the below commands

php bin/magento setup:upgrade
php bin/magento setup:di:compile
php bin/magento indexer:reindex
php bin/magento cache:flush
php bin/magento setup:static-content:deploy -f
chmod -R 777 var/ pub/ generated/

It was working......

Re: Magento Admin redirecting to 404

I was getting the same issue as OP and following those steps still didn't help me find the issue.. I got a little desperate and changed the custom frontname in the app/etc/env.php from 

    'backend' => [
        'frontName' => 'admin'
    ],

to

'backend' => [
'frontName' => 'admin_testing'
],

Then tried going to `localhost/magento/admin_testing` and I got to see the admin panel again HUZZAH!

I could then log in and an error was thrown about a syntax error in one of the acl.xml files, corrected that, then I could go back to `localhost/magento/admin` and it worked as expected.

 

Super annoying issue, this might be a quick solution for someone else!