Amazon S3 redirects based on browser language
I have a multilingual site. I want to redirect English users to / en and Spanish users to / es.
I am currently doing this with Javascript, but I feel there is a better way.
<html>
<body>
<script type="text/javascript">
var language = window.navigator.userLanguage || window.navigator.language;
if (["es","en"].indexOf(language) != -1){
window.location.replace(language);
}
else{
// other languages go to en
window.location.replace("/en");
}
</script>
</body>
</html>
+3
source to share
No one has answered this question yet
Check out similar questions: