index.php未打开

index.php未打开,php,Php,我在这里有一个index.php文件: 但当我键入此路径并按enter键时,它不会打开index.php,因此,如果我键入 它打开了!有什么问题吗 编辑:我还有一个index.php文件: 当我键入此路径并按enter键时,它将打开index.php 那么主目录有什么问题呢?您需要设置Web服务器的DirectoryIndex文件(我现在假设apache): 在httpd.conf中 尝试将以下行添加到.htaccess文件中: DirectoryIndex index.php index

我在这里有一个index.php文件:

但当我键入此路径并按enter键时,它不会打开index.php,因此,如果我键入

它打开了!有什么问题吗


编辑:我还有一个index.php文件:

当我键入此路径并按enter键时,它将打开index.php


那么主目录有什么问题呢?

您需要设置Web服务器的
DirectoryIndex
文件(我现在假设apache):

httpd.conf


尝试将以下行添加到
.htaccess
文件中:

DirectoryIndex index.php index.html

如果您使用的是apache,则需要设置DirectoryIndex,请查看您的
httpd.conf
。应该有一个名为
DirectoryIndex
的行来控制它。应该是这样的:

DirectoryIndex index.html index.htm default.htm index.php index.pl

可能在同一路径中有一个文件名index.html。或者您没有目录索引。

从根文件夹中删除.htaccess对我有帮助。

对于我正在使用的Apache服务器,它通过向.htaccess文件添加一行简单的代码帮助我重写了规则。在您的情况下,可能是:

RewriteRule ^http://localhost/widget_corp/explore/home/$ http://localhost/widget_corp/explore/home/index.php [L]


需要更多的细节。你在运行什么操作系统?什么web服务器软件?检查您的
home
文件夹是否没有
index.html
文件!!我做了一些编辑。检查Outindows WAMP Server@localhostno home directory中没有index.html文件,只有index.php文件和一个home.html.php文件,我将其用作模板。这里还有一个index.php文件:当我键入此路径并按enter键时,它会打开index.php,那么home directory有什么问题吗?Apache设置:DirectoryIndex.phpindex.php3 index.html index.html我这里也有一个index.php文件:当我键入此路径并按enter键时,它会打开index.php,然后主目录有什么问题?我这里也有一个index.php文件:当我键入此路径并按enter键时,它会打开index.php,然后主目录有什么问题?这是我的目录索引apache'code'目录index.php index.php3 index.html index.htm'code'@yusufiqbalpk-您的主目录中是否有
.htaccess
文件?它是否包含
DirectoryIndex
设置?我这里还有一个index.php文件:当我键入此路径并按enter键时,它会打开index.php,然后主目录有什么问题?Apache设置:DirectoryIndex.php index.php3 index.html index.html该文件夹中有
.htaccess
文件吗?这是个坏主意。BAD@blackblue如果它解决了问题,那就没那么糟糕了,你可以通过检查.htaccess中的错误来测试它是什么导致了这一问题,正如我所说的,idc帮助我解决了负面问题。想法不好,没有解释就不好——用户通常是初学者,而懒惰的初学者,他们只是遵循最简单的方法。一次否决不会伤害到你,请放大你的答案的必要细节-什么时候是安全的,删除哪一行而不是整个文件,我将测试是否有可能收到否决票(还不知道)*取消而不是“收到”
RewriteRule ^http://localhost/widget_corp/explore/home/$ http://localhost/widget_corp/explore/home/index.php [L]