How to rewrite a url based on accept-language
- by Anthony Faull
I have a website in three languages with a directory for each: i.e. /en-US/, /de-DE/ and /fr-FR/. I would like the web server to use the browser's accept-language string to return content in the language of the user.
Examples:
(a) "pl-PL;fr-FR;en-US" should redirect to /fr-FR/.
(b) "de;fr-FR" redirects to /de-DE/
(c) "jp-JP" redirects to /en-US/.
How would I do this in an .htaccess file?