Dear forum,
I am running a multilanguage site and do have the following problem:
When setting a default language, kirby always redirects to this lang (in my case ‘en’). So if you open domain.tld/ it will redirect to domain.tld/en
But I want to implement a basic lang-detection using PHP. Which works basically. The language is detected correctly. What I want to do is, check if the URL contains one of the supported language (en/de). If it doesn’t I want to redirect to the detected language. Currently I am doing this in my template as the very first thing.
Now here’s the problem: Kirby redirects before I can do. It will redirect to /defaultLang/… even before I can take action in my template. I also tried the same thing using a route, but this route will also take action AFTER the defaultLang redirect.
So is there an option to disable that defaultLang redirect or a place where I should do my lang-detect so it runs before kirbys lang-redirect?
I also tried the language.detect option, but it seems like it doesn’t work as expected (which maybe documented here: [Panel] Add auto-save not only on blur, but every X seconds · Issue #268 · getkirby/kirby · GitHub). So I deactivated it again.
Maybe you have any ideas? Thank you!