centos中 ,设置index.html 和 index.php的优先级

来源:互联网 发布:谷歌娘软件 编辑:程序博客网 时间:2024/05/17 03:32

在centos中,安装完apache和php后,默认情况下是index.php优先级最高.

如果想要更改为index.html优先的话,需要对文件进行如下编辑:

编辑httpd.conf文件,找到DirectoryIndex这行,加上index.php 如下:

DirectoryIndex index.html index.htm index.php

保存编辑的内容(在vi下,按下esc后输入 :wq 回车, 即可保存编辑的文本内容并退出)

再修改一下php相关配置文件php.conf:

 /etc/httpd/conf.d/php.conf  文件中的  DirectoryIndex  index.html index.htm index.php


这样优先级的顺序为 index.html > index.htm > index.php

最后 重启Apache :  service httpd restart 

(如果遇到bash: service: command not found,说明命令路径有问题, 在命令前面加入 /sbin/ 即可)




0 0