Apache服务器配置默认首页文件名和网站路径


 

默认首页的配置:

      第一种:直接修改apache服务器的配置文件./conf/httpd.conf中的DirectoryIndex,如:(项目web以index.php为首页) 

<IfModule dir_module>
                        DirectoryIndex index.html index.php
                  </IfModule>

      第二种:apache服务器的配置文件./conf/httpd.conf中DirectoryIndex默认不变为index.html,此时需要当前项目下增加一个index.html文件,文件的内容如下编辑:(项目web以index.php为首页)

index.html文件的内容如下:

<meta http-equiv="refresh" content="0; url=index.php">

      以上两种方式,在地址栏中输入http://localhost/web就可以直接访问到index.php的页面。

默认网站的配置:(项目以web为例)

      第一种:直接修改apache服务器的配置文件./conf/httpd.conf中的DocumentRoot和Directory,如:

DocumentRoot "/usr/local/apache/htdocs/web"

<Directory "/usr/local/apache/htdocs/web">

      第二种:不修改apache服务器的默认配置文件httpd.conf,而是,修改./htdocs/目录下的index.html文件:

index.html文件的内容如下:

<meta http-equiv="refresh" content="0; url=/web">

       以上两种方式,在地址栏中输入http://localhost就可以直接访问到web项目的网站。


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM