Apache不根自动执行的index.php脚本 [英] Apache doesn't execute script of index.php in root automatically

查看:518
本文介绍了Apache不根自动执行的index.php脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是奇怪的:我的Apache配置有的DirectoryIndex index.html的,的index.php 所以当我输入的 HTTP://gustavopi-macmini.local/ 它搜索的index.php 和负荷就OK,如果只有html标签的文件中。

This is strange: my Apache is configured with DirectoryIndex index.html,index.php so when I type http://gustavopi-macmini.local/ it searches for index.php and loads it ok if there is only html tags in the file.

但是,如果我把一些PHP脚本的index.php ,它加载 index.html.en 代替(有用!)。不过,如果我输入 HTTP://gustavopi-macmini.local/index.php 它加载和执行脚本。

But if I put some php script in index.php, it loads index.html.en instead (It Works!). However, if I type http://gustavopi-macmini.local/index.php it loads and executes the script.

另外,如果我把一个的index.php 文件中的一个子目录和类型的 HTTP://gustavopi-macmini.local/somesubdirectory/ 它加载并执行的index.php 正常,因为它应该...

Also, if I put an index.php file in a subdirectory and type http://gustavopi-macmini.local/somesubdirectory/ it loads and executes index.php normally as it should...

为什么这个奇怪的行为跳跃,从一个PHP脚本在根发生?

Why this strange behavior of "jumping" from a php script in the root occurring?

推荐答案

订单的定义目录索引的文件还确定其优先级。

The order of the defined 'directory index' files also determine their priority.

在您的情况,如果双方的 index.html的的index.php 是present, Apache会挑 index.html的

In your situation, if both an index.html and a index.php are present, Apache will pick the index.html.

要改变这种情况,改变目录索引文件的顺序;

To change this, change the order of the 'directory index' files;

DirectoryIndex index.php index.html

在这里阅读文档:

Read the documentation here:

<一个href=\"http://httpd.apache.org/docs/2.2/mod/mod_dir.html\">http://httpd.apache.org/docs/2.2/mod/mod_dir.html

这篇关于Apache不根自动执行的index.php脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆