Despite setting baseUrl alias with trailing slash it appears it gets stripped off in Craft 3.

  'aliases' => [
      '@siteUrl' => getenv('CRAFTENV_SITE_URL'),
      '@baseUrl' => getenv('CRAFTENV_BASE_URL'),
      '@basePath'   => getenv('CRAFTENV_BASE_PATH')


 {% set baseUrl = alias('@baseUrl') %}

which renders


and breaks my craft 2 template links to stylesheets etc.

I can fix with

 {% set baseUrl = alias('@baseUrl') ~ '/' %}

but can't help but think trailing slash was compulsory in Craft 2.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.