为什么将项目托管到Apache,浏览器输入http://127.0.0.1会跳转到http://127.0.0.1//dashboard/?

找到xampp安装的根目录下htdocs文件夹下的index.php文件

<?php
	if (!empty($_SERVER['HTTPS']) && ('on' == $_SERVER['HTTPS'])) {
		$uri = 'https://';
	} else {
		$uri = 'http://';
	}
	$uri .= $_SERVER['HTTP_HOST'];
	header('Location: '.$uri.'/dashboard/');
	exit;
?>
Something is wrong with the XAMPP installation :-(

把以下语句注释即可

header('Location: '.$uri.'/dashboard/');

参考博客:macOS -- 为什么XAMPP启动后输localhost跳转到http://localhost/dashboard?

posted on 2019-12-06 16:08  songsong_p_blue  阅读(568)  评论(0编辑  收藏  举报