Magento – Magento 2 admin panel inaccessible after modyfying admin base URL

adminmagento2redirection

After installing Magento 2 on my web hosting account, I changed the admin base URL, and from then, I couldn't access the admin panel any longer. Web browsers state improper redirection that goes into endless loops.

Sometimes I can login to the admin, but cannot proceed further. Then I get stopped here: https://www.example.com/admin/admin/admin/dashboard/index/key/346c5e0399f97b43019e7fda6caa5e4a63e3920b17cda68fba711755c484cfd0/

I ran into the issue while customizing the Magento 2 admin URL and no longer has access to the admin panel. Trying to open the admin page results to "improper redirection" that goes into endless loops. And the URL becomes http://www.example.com/admin/admin/admin/index/index/key/blablabla. I can only get to the admin login page displayed in raw HTML with no formatting. But I can't gain access after typing in the correct login details.

The mistake I made was this:

"Use Custom Admin URL: Yes"

"Use Custom Admin Path: No"

"Custom Admin Path: admin"

I can surely edit PHP files on the server and database tables in phpMyAdmin, if given clear step-by-step instructions.

Below is a screenshot of my "mgct_core_config_data" table regarding admin URL:
enter image description here

Any help would be much appreciated. Thanks in advance.

Best Answer

I see you edited the store's web/secure/base_url and web/unsecure/base_url in your database which supposed to be your store's front url not admin url. So, revert these changes back.

And also revert changes back for admin/url/custom path.

All you need is to edit your app/etc/env.php and at the top of this file change your admin front name.

 'backend' => 
  array (
    'frontName' => 'admin',
  ),

And then flush cache by running php bin/magento cache:flush.

Hope this helps.

Related Topic