[Neos] How to build a multi-language site

Aske Ertmann aske at moc.net
Sat Sep 21 21:51:52 CEST 2013


Hey Lorenz

Flow doesn't overrule the .htaccess rules, that's not possible. What's more likely is that your conditions aren't matched and your rule never takes action. I did a little search on the subject and can see that it's not really encouraged way of redirecting, but I can see it can make sense.

Problem with all the examples I can find is that they check if the header starts with something. In my case that doesn't work because my browser language is english so my header looks like this en-US,en;q=0.8,da;q=0.6

So it's likely your experiencing the same problem, because your browser doesn't have german as the top language.

Instead you can check if the header contains comma and then the language. This is what it looks like in Chrome, but you should check if this is consistent across browsers.

RewriteCond %{HTTP_HOST} !^de.mysite.com$ [NC]
RewriteCond %{HTTP:Accept-Language} .*,de [NC]
RewriteRule http://de.mysite.com/ [R=301,L]

You should also check if the domain is not already the one you're redirecting to, to avoid any redirection loops.

/Aske

On Sep 21, 2013, at 4:09 PM, Lorenz Ulrich <lorenz-typo3 at visol.ch> wrote:

> Hi Aske
> 
> Thanks for this suggestion. I tried using HTTP_ACCEPT_LANGUAGE in the .htaccess file but somehow Flow seems to ignore the RewriteCondition or rather do it's own redirects later on. This is my RewriteCondition:
> 
> RewriteCond %{HTTP:Accept-Language} (^de) [NC]
> RewriteRule http://www.mysite.com/de/ [R=301,L]
> 
> I thought that this would redirect to /de/ and not execute any further rules. But it doesn't work.
> 
> Thanks for any hint.
> 
> Best regards,
> 
> Lorenz
> 
> Am 10.09.2013 08:55, schrieb Aske Ertmann:
>> Hi Lorenz
>> 
>> I think you can do this in many ways. It could be done with htaccess rewrite rules using the HTTP_ACCEPT_LANGUAGE header, or in JavaScript. If you don't want to do it in htaccess you could register a custom request handler or use AOP or some interface overwriting, this might break at some point though and probably not the best solution.
>> 
>> /Aske
>> 
>> On 08/09/2013, at 23.05, Lorenz Ulrich wrote:
>> 
>>> Hi Christian
>>> 
>>>> You will want to use one site package and just create two pages "en" and
>>>> "de" and underneath the respective structures. Additionally you probably
>>>> need to adjust the lang attributes depending on the tree you are in, but
>>>> that should be pretty easy with CASE statement in TypoScript.
>>> 
>>> Thanks for your advice. I built my structure as suggested.
>>> 
>>> Now I'm wondering how I could load the English or German version depending on browser languages.
>>> 
>>> I guess there is no configuration for that. Do I need to write a plugin? Use some AOP the hook into the request?
>>> 
>>> Thanks and best regards,
>>> 
>>> Lorez
>>> 
>>> Am 29.08.2013 11:36, schrieb Christian Müller:
>>> 
>>> _______________________________________________
>>> Neos mailing list
>>> Neos at lists.typo3.org
>>> http://lists.typo3.org/cgi-bin/mailman/listinfo/neos
>> 
> 
> _______________________________________________
> Neos mailing list
> Neos at lists.typo3.org
> http://lists.typo3.org/cgi-bin/mailman/listinfo/neos



More information about the Neos mailing list