更改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;
?>
復制代碼


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM