<?php
$browserLanguage = $_SERVER['HTTP_ACCEPT_LANGUAGE'] ?? 'en';
$lang = substr(strtolower($browserLanguage), 0, 2);
$acceptLang = array('es', 'pt', 'en');
$lang = in_array($lang, $acceptLang) ? $lang : 'en';
header("Location: index-{$lang}.php", true, 302);
exit;
