📅  最后修改于: 2022-03-11 14:54:33.233000             🧑  作者: Mango
$url = $_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
if (preg_match('/www./', $url)){
$url = str_replace('www.','https://', $url);
header( "HTTP/1.1 301 Moved Permanently" );
header( 'Location: ' . $url );
exit;
}