Redirect to parent environment when accessing new Integration environment

This article provides troubleshooting steps for an Adobe 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

Adobe Commerce on cloud infrastructure 2.X.X

Issue

Steps to reproduce:

  1. Clone the existing Integration branch.
  2. 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 Adobe Commerce CLI (available in version 2.2.0 and later).

Update values manually

  1. Connect to the database.

  2. 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 Adobe Commerce CLI (for version 2.2.X and later)

  1. Log in as, or switch to, the Adobe Commerce file system owner.

  2. 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

recommendation-more-help
3d58f420-19b5-47a0-a122-5c9dab55ec7f