When users request /
, I want to redirect them to /en
or /de
, depending on their preference specified in the HTTP request header Accept-Language
.
I guess this is easy with server-side scripting, but I need a .htaccess
solution as it has to work for a static site.
What I tried:
- mod_negotiation (either with a type map or with the
MultiViews
option):
Users get their preferred language, but they don’t get redirected.
- mod_rewrite (
RewriteCond %{HTTP:Accept-Language}
):
Users get redirected, but they don’t (necessarily ‡) get their preferred language.
(‡ Neither does it assure that the language has a quality value greater than 0, nor does it find the preferred language in case both languages are specified with different quality values.)
Is there a solution for this?
Whether making content negotiation redirect somehow, or allowing to check/compare quality values in the RewriteCond
directive, or something totally different.