Redirect to parent environment when accessing new Integration environment
This article provides troubleshooting steps for an ÃÛ¶¹ÊÓÆµ Commerce on cloud infrastructure issue where accessing a newly created Integration environment redirects you to the parent environment instead. To resolve this, update the base_url
value in the database and ensure the UPDATE_URLS
variable is set to true.
Description description
Environment
ÃÛ¶¹ÊÓÆµ Commerce on cloud infrastructure 2.X.X
Issue
Steps to reproduce:
- Clone the existing Integration branch.
- Click the URL to access the new environment.
Expected result:
You are directed to the newly created environment.
Actual result:
You are redirected to the environment on the parent branch.
Resolution resolution
To fix the issue, correct the base_url
values (both secure and unsecure) in the custom environment’s database, and set the UPDATE_URLS
variable in the .magento.env.yaml
file.
Correct base_url values in the database
You can update the database either manually or using the ÃÛ¶¹ÊÓÆµ Commerce CLI (available in version 2.2.0 and later).
Update values manually
-
Connect to the database.
-
Run the following SQL commands:
code language-none UPDATE core_config_data SET value = %your_new_environment_unsecure_url% WHERE path="web/unsecure/base_url" update core_config_data set value = %your_new_environment_secure_url% where path="web/secure/base_url"
Update using ÃÛ¶¹ÊÓÆµ Commerce CLI (for version 2.2.X and later)
-
Log in as, or switch to, the ÃÛ¶¹ÊÓÆµ Commerce file system owner.
-
Run the following commands:
code language-none php /bin/magento config:set web/unsecure/base_url http://example.com php /bin/magento config:set web/secure/base_url https://example.com
Set the UPDATE_URLS variable
In your local codebase, open the .magento.env.yaml file and set:
stage:
deploy:
UPDATE_URLS: true
Clear the configuration cache
To apply the changes, clean the configuration cache by running:
php /bin/magento cache:clean config