0
votes

I am using TYPO3 v9.5 LTS.

The following languages are defined:
0 = en
1 = de

Site Config General:
[base] = /

Site Config Language 0 (EN):
[base] = /en/

Site Config Language 1 (DE):
[base] = /de/

Now when you access the domain without any URL segment for the language, the user gets always redirected to the default language (en) instead if the proper browser language of the user (de).

Am I missing any configuration parameter in order to get a proper language redirect?
Or do I need make any configuration in TypoScript?

Thanks in advance :)

1
Haven't used it yet, but maybe this extension will help: extensions.typo3.org/extension/site_language_redirectionAbdull

1 Answers

4
votes

Redirection by user language does not exist in TYPO3 itself, you will need to implement this yourself.

Here is a basic example for an Apache .htaccess:

RewriteCond %{REQUEST_URI} ^/$
RewriteCond %{QUERY_STRING} ^$
RewriteCond %{HTTP:Accept-Language} ^(de|en)
RewriteRule ^ https://%{HTTP_HOST}/%1/ [R=301,L,QSA]

This redirects all basic URLs depending on the browser language. So https://example.org/ will be redirected either to https://example.org/de/ or https://example.org/en/ or kept unchanged if a different language than German or English is preferred. URLs which already have a path (and thus a language segment) won't be redirected as are URLs which have a query string, thus things like https://example.org/?eID=... are not redirected.