Redirect to parent environment when accessing new Integration environment
This article provides troubleshooting instructions for the Adobe Commerce on cloud infrastructure issue where trying to access the newly created Integration environment takes you to the parent environment instead.
To fix this, you need to correct the base_url value in the database and make sure that the UPDATE_URLS
variable value is set to true
. Find more details in the sections below.
Affected versions and editions:
- Adobe Commerce on cloud infrastructure 2.X.X
Issue
Steps to reproduce:
- Clone the existing Integration branch.
- Click the URL for accessing the new environment.
Expected result:
You get to the newly created environment.
Actual result:
You get redirected to the environment on the parent branch.
Solution
To fix the issue, you need to correct the base_url
values (secure and unsecure) in the custom environment database and set the UPDATE_URL
variable in the .magento.env.yaml
file.
Correct base_url values in database
Changes in the database can be done either manually or using the Adobe Commerce CLI, if you are on version 2.2.0 and later.
Correct the values in the DB manually
- Connect to the database.
- Run the following commands:
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"
Correct the database using Adobe Commerce CLI (available for versions 2.2.X)
- Log in as, or switch to, the Adobe Commerce file system owner.
- Run the following commands:
php <your_magento_install_dir>/bin/magento config:set web/unsecure/base_url http://example.com
php <your_magento_install_dir>/bin/magento config:set web/secure/base_url https://example.com
Set the UPDATE_URLS
variable
In your local codebase, in the .magento.env.yaml
file set:
stage:
deploy:
UPDATE_URLS: true
Clear configuration cache
For the changes to be applied, clean the configuration cache by running the following command:
php <your_magento_install_dir>/bin/magento cache:clean config