简体   繁体   English

TYPO3 v9.5站点:语言重定向

[英]TYPO3 v9.5 Sites: Language Redirects

I am using TYPO3 v9.5 LTS. 我正在使用TYPO3 v9.5 LTS。

The following languages are defined: 定义了以下语言:
0 = en
1 = de

Site Config General: 站点配置常规:
[base] = /

Site Config Language 0 (EN): 站点配置语言0(EN):
[base] = /en/

Site Config Language 1 (DE): 站点配置语言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). 现在,当您访问没有该语言的任何URL段的域时,总是将用户重定向到默认语言(en),而不是用户的正确浏览器语言(de)。

Am I missing any configuration parameter in order to get a proper language redirect? 我是否缺少任何配置参数以获取正确的语言重定向?
Or do I need make any configuration in TypoScript? 还是我需要在TypoScript中进行任何配置?

Thanks in advance :) 提前致谢 :)

Redirection by user language does not exist in TYPO3 itself, you will need to implement this yourself. TYPO3本身不存在通过用户语言进行的重定向,您需要自己实现。

Here is a basic example for an Apache .htaccess : 这是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. 这将根据浏览器语言重定向所有基本URL。 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. 因此, https://example.org/将重定向到https://example.org/de/https://example.org/en/,或者如果首选德语或英语以外的其他语言,则将保持不变。 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. 已经具有路径(因此具有语言段)的URL不会像具有查询字符串的URL一样被重定向,因此不会重定向https://example.org/?eID= ...之类的内容。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM