I attempted to change my admin url.

Originally I was going to set it up on a subdomain but apparently followed a bad or outdated tutorial. I changed "Use Custom Admin URL" to Yes and then "Custom Admin URL" to https://admin.example.com/admin_abc123. I also configured apache and dns for the subdomain but I'm not sure that's relevant.

It didn't initially work, so I attempted to revert by modifying these values in the database to what they were.

But now I get an infinite redirect. When I go to https://admin.example.com/admin_abc123/ I appear to be redirected to https://admin.example.com/admin_abc123/admin_abc123/admin/.....

And I get an error:

This page isn’t working

example.com redirected you too many times.

How can I solve this issue?

Edit: Also tried php bin/magento setup:config:set --backend-frontname="admin_abc123" which showed a success message but did not fix the problem.

2 Answers 2


Open your database and put:

select * from core_config_data where path like "web/%secure/base_url" or path = 'web/cookie/cookie_domain';

Then replace values by old url.


Originally my hosting provider fixed the issue for me but I had to do this again and figured out the answer from their notes.

This as far as I'm concerned is a bug. You should be able to change the admin url to a subdomain through the backend UI without manually editing the database.

After saving changes the following entries appear in DB (core_config_data):

scope   path                  value
default admin/url/custom      https://admin.example.com/admin_abc123/
stores  web/secure/base_url   https://admin.example.com/admin_abc123/
stores  web/unsecure/base_url https://admin.example.com/admin_abc123/

Changing the new web/secure/base_url and web/unsecure/base_url to https://admin.example.com/ resolves the issue.

Note these new entries appear to be under the store scope, changing the wrong values, i.e., the original values under the default scope, may break your frontend.

Edit: I answered my own question incorrectly. This seems to work when the main URL has no www in it but in my attempt it did not.

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.