这是标题的正确URI(‘Location:’),特别是./?
header ('HTTP/1.1 301 Moved Permanently'); header ('Location: ./');
谢谢.
您必须使用
absolute URI according to the spec,因此以下内容适用于您:
原文链接:https://www.f2er.com/php/137878.html// check if the server is secure or not to determine URL prefix if(isset($_SERVER['HTTPS']) and 'on' === $_SERVER['HTTPS']) { $location = 'https://'; } else { $location = 'http://'; } // get the servers base URL $location .= $_SERVER['SERVER_NAME'] . '/'; // grab the current URI without a file name in it $location .= dirname($_SERVER['REQUEST_URI']) . '/'; header('Location: ' . $location); exit();