I was wondering if the following setup is a good practice.
In my .env file I defined a single rootUrl var which contains the site root url like this:
In the general.php config file i've created an alias (@rootUrl) that contains the ROOT_URL env var value:
'aliases' => [
'@rootUrl' => getenv('ROOT_URL'),
Then I define my craft sites as following (multilingual site), each site BASE URL is constructed with the rootUrl and a language:
- You don't have to define every site (language) in the code, languages are managed through the cms (in case of multisite setup, you should define a ROOT_URL for every site).
- the @rootUrl alias can be used as part of the resource path in the templates.
- Could this also resolve in a caching issue (like the @web alias)?
Does this logic makes sense or is it generally a bad idea to use aliases for the site BASE URL setting?
Thanks in advance