Multisite and multilang config

Hi everyone,

I launched an english version of my website a few weeks ago. It’s working like a charm. Here’s the config :

//LANGS
c::set('language.detect', false);
c::set('languages', array(
  array(
    'code'    => 'fr',
    'name'    => 'Français',
    'default' => true,
    'locale'  => 'fr_FR',
    'url'     => '/fr',
  ),
  array(
    'code'    => 'en',
    'name'    => 'English',
    'locale'  => 'en_US',
    'url'     => '/en',
  )
));

Since my primary language is french but I want non-french readers to be directed to the english website, I used this in the .htaccess file :


# language starts with FR
RewriteCond %{HTTP:Accept-Language} ^fr [NC]
RewriteRule ^$ /fr/ [L,R=301]

# language starts with EN
RewriteCond %{HTTP:Accept-Language} ^en [NC]
RewriteRule ^$ /en/ [L,R=301]

# else redirect to the English version
RewriteRule ^$ /en/ [L,R=301]

But I forgot I had a subdomain blog! It’s using the multisite config of kirby and if almost everything works normally, the blog is not multilang at all. Now the homepage redirects to /en or /fr even if I remove the htaccess lines.

Is there any way of getting this subdomain work as a single language site again?

If you can have only one config.php file in such a multi-site installation, you can’t have a multi-lang site and a single-lang site concurrently, so you would have to run the blog with at least a single language as well and maybe use permissions to prevent filling in the wrong language in the Panel. And shouldn’t it be possible to redirect based on the domain in your .htaccess?

Otherwise, it would probably make sense to run the blog as it’s own separate Kirby installation.

It took a bit of work but in the end the more efficient way was to change the default language from english to french and let kirby detect the language. Thanks @texnixe for you help.