Magento 2 – Admin Infinite Redirect After Changing Admin URL

adminmagento2

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.

Best Answer

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.