Hi, I have a WordPress Multisite installation. I use the main domain for the Spanish language and the subdomain en.paideiastudio.net for the English language. Do I have a way to make a redirect from the main domain to English when the visitor has another language predefined in his browser other than Spanish?
I clarify that I don’t use plugin to translate.
I tried a code but the redirect conflicts.
Can it be done with Rank Math SEO?
The code was:
// Obtener el idioma preferido del navegador del usuario $idioma = isset($_SERVER['HTTP_ACCEPT_LANGUAGE']) ? substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2) : '';
// Verificar el idioma y redirigir a la URL correspondiente if ($idioma !== 'es') { // Redirigir a la versión en inglés header('Location: '); exit(); } else {
// Mantener la versión en español como predeterminada define('DOMAIN_CURRENT_SITE', 'paideiastudio.net'); }
- This topic was modified 13 hours, 26 minutes ago by .
