How to set default language to root

I know it seems like this question was asked many times before, but I just wasn’t able to solve it. Any help would be much appreciated.

Here’s the multi-language website structure I want to achieve:
de_DE: mydomain.de
en_US: mydomain.de/en

languages.detect is set to false in config – I don’t need it and it doesn’t seemed to work anyways.

My /language files look like this as they are described in the documentation:

en.php:

<?php

return [
	'code' => 'en',
	'default' => false,
	'direction' => 'ltr',
	'locale' => 'en_US',
	'name' => 'English',
	'url' => 'en'
];

de.php

<?php

return [
	'code' => 'de',
	'default' => true,
	'direction' => 'ltr',
	'locale' => [
			'de_DE'
	],
	'name' => 'Deutsch',
	'url' => null
];

The result is:

  • / → shows just nothing
  • /de → German website
  • /en → English website

What am I holding wrong here? I’m on the latest version 3.9.6.1.

Turns out my .htaccess file wasn’t configured the way it should be :person_facepalming:

I’ll leave the post here in case someone else has a similar problem at some point.

The normal way to prevent the language code in the URL would be to set

    'url' => '/'

for the default language, not null. No need to disable language.detect, because

Using the root URL for the default language will disable automatic language detection.

1 Like