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.

  • What I'm trying to do is to have the admin URL like this: example.com/admin and not the default URL. From lots of resources I saw online, I have a hunch that the issue lies with this table: mgct_core_config_data. Any insight?
    – Justin
    Commented Sep 29, 2017 at 15:48
  • @Priyank, Thanks for your interest. Please, see the edited post for update.
    – Justin
    Commented Sep 30, 2017 at 10:32

2 Answers 2


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.

  • Thanks for your input. Yes, I edited web/secure/base_url and gave it a value of example.com and web/unsecure/base_url and gave it a value of example.com. What changes exactly do I have to enter for admin/url/custom? I mean the default value to revert back to? The app/etc/env.php still has the code you posted: 'backend' => array ( 'frontName' => 'admin', ),
    – Justin
    Commented Sep 30, 2017 at 16:25
  • You wouldn't need to enter any value in admin/url/custom. I believe, you changed admin configuration in Admin > Stores > Configurations > Advanced > Admin > Admin Base Url > Use Custom Admin Url and > Use Custom Admin Path If so, set those two configurations to No. You might then consider to delete admin/url/custom row from db, if the path still shows old value. And then flush the cache.
    – Asrar
    Commented Sep 30, 2017 at 16:57
  • thanks. I'm now able to gain access again to my admin panel.
    – Justin
    Commented Sep 30, 2017 at 17:22

Thanks guys for your help. You've been both nice.

I've finally managed to log into my admin panel. I found the following info on Stack Overflow very direct to the issue I was facing: https://stackoverflow.com/questions/7202950/magento-admin-url-not-working-404-after-changing-it-cant-go-back

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.