我有一个包含许多不同语言的拼写错误的网页,我不希望人们访问默认语言,但首页除外。
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中使用noMatch
和valueDefault
属性,但没有成功。
有什么想法吗?或者我可能需要使用typoscript吗?
答案 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]
此代码未经测试。尝试&调整,因为它适合你。