It's not clear that the siteUrl config setting and the "Base URL" field in the CP (in Settings > Sites) are in fact the same thing. I suggest renaming siteUrl to baseUrl (obviously, keeping siteUrl as deprecated for a while).
Just “fixed” this by deprecating the siteUrl config setting for 3.6, and we will be fully removing it in 4.0.
The config setting was added at a time when config/general.php was the only way to add per-environment config values, but nowadays it’s preferred that you set sites’ Base URL settings to aliases or environment variables right from the control panel.
@brandonkelly Sounds like a great idea! However, it's not clear to me where or how to set the siteUrl for multi-site configurations on the same environment. AFAIK there is no way to define arrays in a .env file.
Example of a pre 3.6 config/general.php:
'staging' => [
'devMode' => true,
'siteUrl' => [
'default' => 'https://staging.domainA.com/',
'siteB' => 'https://staging.domainB.com/',
'siteC' => 'https://staging.domainC.com/'
],
],
'production' => [
'devMode' => false,
'siteUrl' => [
'default' => 'https://domainA.com/',
'siteB' => 'https://domainB.com/',
'siteC' => 'https://domainC.com/'
],
],
@rbrv Create environment variables for each of those sites’ URLs, either in your .env file or however you’re setting environment variables:
DEFAULT_SITE_URL=https://staging.domainA.com/
SITE_B_URL=https://staging.domainB.com/
SITE_C_URL=https://staging.domainC.com/
You can name them whatever you want, but keep them consistent across each environment. The values should be set based on what the URLs should be for each environment.
Then delete your siteUrl config settings, and edit each site to set their URLs to the environment variables:

@brandonkelly Makes sense, thanks!
Most helpful comment
@brandonkelly Sounds like a great idea! However, it's not clear to me where or how to set the
siteUrlfor multi-site configurations on the same environment. AFAIK there is no way to define arrays in a.envfile.Example of a pre 3.6
config/general.php: