默认情况下不加载

默认情况下不加载

本文介绍了默认情况下不加载 index.php的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

当我访问 http://example.com/myapp/index.php 时,它工作正常.

知道如何解决这个问题吗?

解决方案

Apache 需要配置为将 index.php 识别为索引文件.

实现此目的的最简单方法..

  1. 在您的 Web 根目录中创建一个 .htaccess 文件.

  2. 添加行...

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..

  1. Create a .htaccess file in your web root.

  2. Add the line...

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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-28 01:05