<?php
/**
 * Localização: /index.php
 * Finalidade: Redirecionamento 301 seguro compatível com Autoscaling Linux / Load Balancers
 */

// Previne cache agressivo do navegador durante a migração de servidor
header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");

// Detecção correta de HTTPS considerando o Load Balancer (Proxy Reverso)
$is_secure = false;
if (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') {
    $is_secure = true;
} elseif (!empty($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https') {
    $is_secure = true;
} elseif (!empty($_SERVER['SERVER_PORT']) && $_SERVER['SERVER_PORT'] == 443) {
    $is_secure = true;
}

// Define o destino final correto e atualizado
$destino = "https://selflixvagas.gexcore.com.br/";

// Envia o status HTTP 301 (Moved Permanently) para otimização de SEO e motores de busca
header("HTTP/1.1 301 Moved Permanently");
header("Location: " . $destino);
exit;
?>