首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >默认情况下不加载index.php

默认情况下不加载index.php
EN

Stack Overflow用户
提问于 2010-03-05 11:41:30
回答 5查看 420.4K关注 0票数 117

我刚刚安装了CentOS,Apache和PHP。当我访问我的网站http://example.com/myapp/时,它显示“禁止”。默认情况下,它不会加载index.php文件。

当我访问http://example.com/myapp/index.php时,它工作得很好。

你知道怎么解决这个问题吗?

EN

回答 5

Stack Overflow用户

发布于 2010-03-05 11:54:45

根据猜测,目录索引设置为index.html,或某种变体,请尝试:

DirectoryIndex index.html index.php

这仍将使index.html优先于index.php (如果您需要抛出一个维护页面,这将非常方便)

票数 49
EN

Stack Overflow用户

发布于 2014-11-02 22:05:32

这可能会对某些人有所帮助。下面是来自httpd.conf (Apache version2.2 windows)的代码片段。

# DirectoryIndex: sets the file that Apache will serve if a directory
# is requested.
#
<IfModule dir_module>
    DirectoryIndex index.html
    DirectoryIndex index.php
</IfModule>

现在,这将查找index.html文件,如果没有找到,它将查找index.php。

票数 17
EN

Stack Overflow用户

发布于 2010-03-05 11:49:25

尝试使用以下内容创建.htaccess文件

DirectoryIndex index.php

编辑:实际上,是不是有一个'php-apache‘包,或者你应该把它们都安装在一起?

票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/2384423

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档