简体   繁体   English

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

[英]realURL, if no Language in URL (that is default language) redirect to Frontpage

I have a typo3 webside with many different languages and I do not want people to access the default language with the exception for the frontpage. 我有一个typo3网站,使用多种不同的语言,并且我不希望人们访问默认语言(首页除外)。

http://example.com/us/home is fine http://example.com/us/home很好
http://example.com/uk/home is fine http://example.com/uk/home很好
http://example.com/de/home is fine http://example.com/de/home很好
http://example.com/home is not fine and shall be redirected to http://example.com http://example.com/home不好,应该重定向到http://example.com
http://example.com/home/subpage is not fine and shall be redirect to http://example.com http://example.com/home/subpage不好,应重定向到http://example.com

http://example.com/XX/home XX does not exist as langauge so it will display the 404 page. http://example.com/XX/home XX不存在,因此将显示404页。 This is fine. 这可以。

I tried to play around with the noMatch and valueDefault Attributes in realURL without success. 我尝试在noMatch使用noMatchvalueDefault属性,但没有成功。

Any idea? 任何想法? Or do I maybe need to use typoscript for that? 还是我需要为此使用排印?

Firsts, read how to set up properly languages with RealURL: https://github.com/dmitryd/typo3-realurl/wiki/Notes-for-Integrators#configuring-languages You have to follow that exactly! 首先,阅读如何使用RealURL正确设置语言: https : //github.com/dmitryd/typo3-realurl/wiki/Notes-for-Integrators#configuring-languages您必须完全遵循!

Next, RealURL does not do redirects for you. 接下来,RealURL不会为您进行重定向。 It only encodes and decodes URLs. 它仅对URL进行编码和解码。 Yo should setup redirects with Apache. 您应该使用Apache设置重定向。 Something like: 就像是:

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

This code is untested. 此代码未经测试。 Try & adjust as it fits you. 尝试并根据自己的需要进行调整。

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

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