Aim
Update Domain Name of M2 instance from example.co
to beta.example.com
Steps
So, I changed the Domain Name of my Magento 2 store using the following commands:
bin/magento setup:store-config:set --base-url="http://beta.example.com/"
bin/magento setup:store-config:set --base-url-secure="https://beta.example.com/"
bin/magento cache:flush
bin/magento cache:clean
Result
This worked fine, until the next day. When I tried to load my admin url (http://beta.example.com/admin
), I was forwarded to the below URL with this error:
http://beta.example.com/admin/http:/admin/admin/index/index/key/1a2376cc1c89ea53ca4a903003d3a4859b5c62347cc763a6c0105ea3bae466e/
- "This page isn’t working beta.example.com redirected you too many times."
Regardless of trying to load http://beta.example.com/admin
after clearing cookies on different Browsers and Devices, I couldn't get past this point.
Temporary Workaround
In order to resolve this, I have to clear the cache by running the below commands.
bin/magento cache:flush
bin/magento cache:clean
This seems to work for a bit until I go to load the backend the next day. I can't even reproduce the error until the next day...
Any ideas what could be causing this? Or even why my temp workaround only works for a few hours?
Notes: Day 1
The only thing I can think of that happens overnight is Indexing (maybe). So, I've ran the below command. Will report back in 24 hours
bin/magento indexer:reindex
Notes: Day 2
Indexing had no affect. Admin URL still reset to "broke" the next day. I'll try clearing all cache folders today using the below command. Will report back in 24 hours
rm -rf var/page_cache var/cache var/generation var/div var/view_preprocessed generated/metadata/* generated/code/*
Notes: Day 3
No affect. Tried updating Admin URL to see if that does anything with:
bin/magento setup:config:set --backend-frontname="admin_path"
Notes: Day 4
No affect.
Notes: Day 5
I've narrowed down that it's config
that requires either Cleaning of Flushing with either command.:
bin/magento cache:clean config
or bin/magento cache:flush config
I've yet to determine what changes over ~24hrs for me to have to keep doing this though.