如何让Apache能自动运行index.html

问:如何让Apache能自动运行index.php?

答:编辑httpd.conf文件,找到DirectoryIndex在后面加一个index.php。
例如,我把DirectoryIndex这行改为:DirectoryIndex index.html index.htm index.php index.html.var
保存编辑的内容,重新启动Apache就可以实现了。

<Directory /xxx>
DirectoryIndex index.html index.htm index.php index.php3
</Directory>

酷勤网注:如果上述设置后仍无法按顺序运行首页,那么还得修改一下php相关配置文件php.conf

 /etc/httpd/conf.d/php.conf文件中的

DirectoryIndex index.php

上面是甚至index.php 优先,如果把DirectoryIndex index.php去掉,则index.html,应该也可以改成DirectoryIndex index.html 或者DirectoryIndex  index.html index.php

根据实际最好先做测试
  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值