Magento env.php file stores Environment specific configuration and system-related sensitive data.
With the help of the ‘system’ array node, A System node locks the provided configuration values in the env.php file and disables that field in the admin panel.
Sensitive values might be API keys for the connector, Payment related Stuff, Email Addresses, URLs, and Private Contact related information.
We will set the URL value with the env.php file.
You can’t able to modify it from the Stores -> Configuration -> General -> Web -> Base URL field.
'system' => [ 'default' => [ 'web' => [ 'unsecure' => [ 'base_url' => 'https://mage.test/', 'base_link_url' => '{{unsecure_base_url}}', ], 'secure' => [ 'base_url' => 'https://mage.test/', 'base_link_url' => '{{secure_base_url}}', ], ], ], 'websites' => [ 'mage_india' => [ 'web' => [ 'unsecure' => [ 'base_url' => 'https://mage-india.test/', 'base_link_url' => '{{unsecure_base_url}}', ], 'secure' => [ 'base_url' => 'https://mage-india.test/', 'base_link_url' => '{{secure_base_url}}', 'base_static_url' => '{{secure_base_url}}/static/' ] ] ] ] ];
Here ‘system’ node is used to store URLs for all the websites. If you have a single-store website, You can use only the ‘default’ node and assign your base URL.
If you have multiple websites and you want to set all the website URLs with the env.php file, you can manage it by adding the ‘websites’ node to under the ‘system’ node.
I have added mage_india which is the other website code apart from the base website. You can change it with your original website code. You can add multiple codes to the websites if multiple websites are available.
Using this stuff, You can’t able to change the URL value from the Admin panel. You just need to change it from the env.php file only.