index.php默认不加载 [英] index.php not loading by default
问题描述
我刚刚安装了CentOS,Apache和PHP。当我访问我的网站 http://example.com/myapp/ 时,它说禁止。
当我访问 http://example.com/myapp/index.php ,它工作正常。
有任何想法如何解决这个问题吗?
Apache需要配置为将index.php识别为索引文件。
-
在web根目录中创建一个.htaccess文件。 p>
-
添加行...
DirectoryIndex index.php
关于此事的资源...
http://www.twsc.biz /twsc_hosting_htaccess.php
编辑:我假设apache被配置为允许.htaccess文件。如果不是,您必须修改apache的配置文件(httpd.conf)中的设置
I have just installed CentOS, Apache and PHP. When I visit my site http://example.com/myapp/, it says "forbidden". By default it's not loading the index.php file.
When I visit http://example.com/myapp/index.php, it works fine.
Any idea how to fix that issue?
Apache needs to be configured to recognize index.php as an index file.
The simplest way to accomplish this..
Create a .htaccess file in your web root.
Add the line...
DirectoryIndex index.php
Here is a resource regarding the matter...
http://www.twsc.biz/twsc_hosting_htaccess.php
Edit: I'm assuming apache is configured to allow .htaccess files. If it isn't, you'll have to modify the setting in apache's configuration file (httpd.conf)
这篇关于index.php默认不加载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!