Linking to the homepage in current language

Hey there,

I’m not sure wether this is actually meant to behave like this or wether it’s a bug. Calling $site->url() on a multilang site will always return the base path of the website, thus redirecting to the default rather than the current language…

I’m using $site->url($site->language()->code()) now, however, this doesn’t seem to be the best solution.

Any opinions?

You can use $site->language()->url().

1 Like