-
-
Save adrianolsk/7c52c8d520b3cfa21d4dc07290adf6de to your computer and use it in GitHub Desktop.
Nginx can redirect to language subsite based on browser language
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
map $http_accept_language $index_redirect_uri { | |
default "/en/"; | |
"~(^|,)en.+,ru" "/en/"; | |
"~(^|,)ru.+,en" "/ru/"; | |
"~(^|,)en" "/en/"; | |
"~(^|,)ru" "/ru/"; | |
} | |
location = / { | |
return 302 $index_redirect_uri; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment