分享

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

 ZK梧桐树下 2011-05-22

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

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;
?> 

 

 

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多