Multilingual front page- redirect anonymous users based on browser language I have a Drupal 7 site that is available in both English and Japanese.  I am using i18n and entity translation; I have configured the User interface text language detection at /admin/config/regional/language/configure as follows:


User
URL
Browser
Default


This is great for authenticated users and for all pages of the site except the front page, which is the most important.

I would like users with Japanese browsers to be taken to the Japanese version and all other users to be taken to the English version.  However, since the site default language is English, it appears that all users are by default taken to the English version.

If it matters, my front page is actually a panel.

How can I configure it so that users with Japanese browsers are redirected to the Japanese language version?  I don't want to move browser to the top of the list because I want to respect user preferences for authenticated users, and I also need URL to precede browser because I want people to be able to use the language switcher block to change the language if for some reason they are using a browser in a language they are not comfortable with.
This is inspired by a deleted answer, but my first approach would be to have the whole site built with Panels, and then have an English variant and Japanese variant for each.

For each variant, you would use the PHP Code selection rule, and then add your logic.

For unauthenticated users, you could examine $_SERVER["HTTP_ACCEPT_LANGUAGE"] and return the proper thing.  For authenticated users, would would use your normal method.

Preferably, you would put the logic in a module function that you would call from the PHP Code selection rule, so you only need to change things in one place.  You could also do a ctools plugin to make your own selection rule, too, using the same logic.