Пример кода php для редиректа на https

Материал из Wiki - Iphoster - the best ever hosting and support. 2005 - 2023
Перейти к:навигация, поиск

Пример кода php для редиректа на https

if( cfgset("cfgSSL") == "on" ) {
   $http = "https";
   if(!isset($_SERVER['HTTPS']) || $_SERVER['HTTPS'] == ""){
       $redirect = "https://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
       header("HTTP/1.1 301 Moved Permanently");
       header("Location: $redirect");
   }
} else {
   $http = "http";
}
Индекс цитирования