The Magento CLI application allows you to set store URLs directly, like so: bin/magento setup:store-config:set \ --base-url="http://example.dev/" --base-url-secure="https://example.dev/"

But how can you set the store URL for the second Magento store? I've tried setting the MAGE_RUN_CODE, like so, but this only changed the default base store.

bin/magento setup:store-config:set \ --magento-init-params="MAGE_RUN_CODE=otherstore&MAGE_RUN_TYPE=website" \ --base-url="http://example2.dev/" --base-url-secure="https://example2.dev/"

Is there something I'm missing? Is it possible to set store config options for stores other than the default store?


1 Answer 1


You can specify a website or store directly with the param --scope and --scope-code

php bin/magento config:set --help

  Change system configuration

  config:set [options] [--] <path> <value>

  path                         Configuration path in format section/group/field_name
  value                        Configuration value

      --scope=SCOPE            Configuration scope (default, website, or store) [default: "default"]
      --scope-code=SCOPE-CODE  Scope code (required only if scope is not 'default')
  -e, --lock-env               Lock value which prevents modification in the Admin (will be saved in app/etc/env.php)
  -c, --lock-config            Lock and share value with other installations, prevents modification in the Admin (will be saved in app/etc/config.php)
  -l, --lock                   Deprecated, use the --lock-env option instead.
  -h, --help                   Display this help message
  -q, --quiet                  Do not output any message
  -V, --version                Display this application version
      --ansi                   Force ANSI output
      --no-ansi                Disable ANSI output
  -n, --no-interaction         Do not ask any interactive question
  -v|vv|vvv, --verbose         Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.