if($_SERVER["REMOTE_ADDR"] == "9995.166.54.168") { print_r($_SERVER); $url = "https://{$_SERVER['SERVER_NAME']}{$_SERVER['REQUEST_URI']}"; die($url); } if(preg_match("/new.ozhydro\.ru/", $_SERVER["SERVER_NAME"])) { header("HTTP/1.1 301 Moved Permanently"); header("Location: https://new.ozhydro.ru/");exit; } if(preg_match("/ozhydro\.ru/", $_SERVER["SERVER_NAME"])) { header("HTTP/1.1 301 Moved Permanently"); $url = "https://{$_SERVER['SERVER_NAME']}{$_SERVER['REQUEST_URI']}"; header("Location: {$url}");exit; header("Location: https://ozhydro.ru/");exit; } if(preg_match("/xn\-\-80aaaaal6cegsiqgpp5f\.xn\-\-p1ai/", $_SERVER["SERVER_NAME"])) { header("HTTP/1.1 301 Moved Permanently"); header("Location: https://xn--80aaaaal6cegsiqgpp5f.xn--p1ai/");exit; } // die($_SERVER["SERVER_NAME"]); ?>
It works fine!