This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.

info12216
info12216

Hello, I use Translate plugin on my site which I have 3 languages and use force url schema. Is it possible ony for home page have url with url prefix? now I have www.mypage.com/en www.mypage.com/de www.mypage.com/sk

and I want only for homepage and only for en languge url withou language prifix like www.mypage.com
Thank you

daftspunky
daftspunky

Unfortunately, the Translate plugin does not support this natively. When opening the website without /en it will default to the session stored locale. However, to overcome this, you could add some PHP code to your layout to force it to always be EN.

function onStart() 
{
    $translator = \RainLab\Translate\Classes\Translator::instance();

    // No URL locale found
    if (!$translator->loadLocaleFromRequest()) {
        // Force EN locale
        $translator->setLocale('en');
    }
}

I hope this helps!

Last updated

1-2 of 2

You cannot edit posts or make replies: the forum has moved to talk.octobercms.com.