我将一个 index.html 文件和一个 index.php 文件放在我网站的根目录中,当我导航到我的网站 www.site.com 时,它提供的是 php 文件而不是 html 文件,我的问题是为什么?为什么它通过 html 为 php 提供服务? Apache 服务器。
最佳答案
检查 Apache 的 DirectoryIndex 指令。
http://httpd.apache.org/docs/2.0/mod/mod_dir.html
例如
DirectoryIndex index.html index.php
将尝试首先提供 html,如果它不存在,它将提供 php。
关于apache - 优先级、HTML 和 PHP 索引文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7203581/