优化 index.php 优化默认首页的本地跳转

This commit is contained in:
Comsenz 2017-11-13 13:59:33 +08:00
parent 7471b17f9c
commit 532e2125c1
1 changed files with 10 additions and 2 deletions

View File

@ -124,8 +124,16 @@ if(!empty($url)) {
} elseif(isset($_GET['fromuser']) && $_GET['fromuser']) {
$url .= sprintf('%sfromuser=%s', $delimiter, rawurlencode($_GET['fromuser']));
}
header("HTTP/1.1 301 Moved Permanently");
header("location: $url");
$parse = parse_url($url);
if(!isset($parse['host']) && file_exists($parse['path'])) {
if(!empty($parse['query'])) {
parse_str($parse['query'], $_GET);
}
require './'.$parse['path'];
} else {
header("HTTP/1.1 301 Moved Permanently");
header("location: $url");
}
} else {
require './'.$_ENV['curapp'].'.php';
}