realURL,如果URL中没有语言(即默认语言)重定向到Frontpage

时间:2016-08-04 15:30:37

标签: typo3 realurl typo3-7.6.x

我有一个包含许多不同语言的拼写错误的网页,我不希望人们访问默认语言,但首页除外。

http://example.com/us/home很好 http://example.com/uk/home很好 http://example.com/de/home很好 http://example.com/home不正常,应重定向到http://example.com
http://example.com/home/subpage不正常,应重定向到http://example.com

http://example.com/XX/home XX不存在为langauge,因此它将显示404页面。这很好。

我试图在realURL中使用noMatchvalueDefault属性,但没有成功。

有什么想法吗?或者我可能需要使用typoscript吗?

1 个答案:

答案 0 :(得分:1)

首先,了解如何使用RealURL正确设置语言:https://github.com/dmitryd/typo3-realurl/wiki/Notes-for-Integrators#configuring-languages您必须完全遵循这一点!

接下来,RealURL不会为您重定向。它只对URL进行编码和解码。你应该用Apache设置重定向。类似的东西:

RewriteCond %{REQUEST_URI} !^/((de|us|uk)/.*)$
RewriteRule .* /de/%1 [L,R=301]

此代码未经测试。尝试&调整,因为它适合你。