码迷,mamicode.com
首页 > Web开发 > 详细

更改Apache默认起始(索引)页面:DirectoryIndex

时间:2015-05-19 12:29:03      阅读:188      评论:0      收藏:0      [点我收藏+]

标签:

Apache默认索引页面是index.html,修改成其他文件需要修改httpd.conf文件:

 

技术分享
#
# DirectoryIndex: sets the file that Apache will serve if a directory
# is requested.
#
<IfModule dir_module>
DirectoryIndex index.html index.php
</IfModule>
技术分享

 

可在Apache根目录建立一个负责跳转的index.php,比如输入IP地址直接跳转到http://ip/myweb/

 

技术分享
<?php
if (!empty($_SERVER[‘HTTPS‘]) && (‘on‘ == $_SERVER[‘HTTPS‘])) {
$uri = ‘https://‘;
} else {
$uri = ‘http://‘;
}
$uri .= $_SERVER[‘HTTP_HOST‘];
header(‘Location: ‘.$uri.‘/myweb/‘);
exit;
?>
技术分享

更改Apache默认起始(索引)页面:DirectoryIndex

标签:

原文地址:http://www.cnblogs.com/xuan52rock/p/4514096.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!