如何让Apache服务的index.php的,而不是index.html的? [英] How to make Apache serve index.php instead of index.html?

查看:174
本文介绍了如何让Apache服务的index.php的,而不是index.html的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我把下面一行在 index.html的文件,以让Apache包括的index.php 文件:

If I put the following line in a index.html file, to make Apache include the index.php file:

  <?php include("/Live/ls_client/index.php"); ?>    

index.html的页面显示我:

<!--?php include("/Live/ls_client/index.php"); ?-->

这是为什么?为什么没有它实际上包含PHP文件?

Why is that? Why doesn't it actually include the PHP file?

推荐答案

正如其他人指出,最有可能你没有的.html 设置来处理PHP做$ C $角

As others have noted, most likely you don't have .html set up to handle php code.

话虽如此,如果你正在做的是使用 index.html的包括的index.php ,你的问题可能应该是我如何使用的index.php 为索引文件?

Having said that, if all you're doing is using index.html to include index.php, your question should probably be 'how do I use index.php as index document?

在这种情况下,为Apache(httpd.conf文件),搜索的DirectoryIndex 以及与此更换行(如果你有只会工作 dir_module 启用,但是这是在默认情况下多数安装):

In which case, for Apache (httpd.conf), search for DirectoryIndex and replace the line with this (will only work if you have dir_module enabled, but that's default on most installs):

DirectoryIndex index.php

如果您使用其他目录索引,​​列出它们在preference即顺序。

If you use other directory indexes, list them in order of preference i.e.

DirectoryIndex index.php index.phtml index.html index.htm

这篇关于如何让Apache服务的index.php的,而不是index.html的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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