Integration Examples
Here are some ways to implement language redirects:
JavaScript Redirect
// Detect browser language and redirect
const lang = navigator.language || navigator.userLanguage;
if (lang.startsWith('zh')) {
window.location.href = '/index.html';
} else {
window.location.href = '/en/';
}
Nginx Configuration
# Language detection based on Accept-Language
location / {
if ($http_accept_language ~* "zh") {
return 301 /index.html;
}
return 301 /en/;
}
HTML Meta Redirect
<meta http-equiv="refresh" content="0; url=/en/">