为什么index.html的有优先的index.php? [英] Why does index.html have priority over index.php?

查看:199
本文介绍了为什么index.html的有优先的index.php?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一台服务器上的网站。该主页是example.com/index.php。

I have a website on a server. The homepage is example.com/index.php .

好吧,我上传了一个名为index.html文件到服务器(根目录),当我在网站的域名在浏览器的地址栏中键入,我很惊讶,因为index.html页面加载。

OK, I uploaded an index.html named file to the server (the root dir) and when I typed in my site's domain into the browser's URL bar, I was suprised, because the index.html page loaded.

(example.com-> example.com/index.html)
所以,不是我想要的。

(example.com->example.com/index.html) So not what I wanted.

我的问题:
为什么会这样?为什么有index.html的优势的index.php?

My question: Why did that happen? Why does index.html have advantage over index.php?

推荐答案

这真的取决于你所使用的服务器上。这是结构的问题。这并不是说有一个从使用HT​​ML与PHP文件类型的任何优势。

It really depends on the Server you're using. This is a matter of configuration. It's not that there's any advantage from using html vs php filetype.

您可以说,的.html 的变化有precedence由于事实,这是最基本的网络格式。

You could say that the .html variation takes precedence due to the fact that it's the most basic web format.

如果你使用Apache,只检查默认的.htaccess 设置:

If you're using Apache, just check the default .htaccess setup:

DirectoryIndex index.html index.shtml index.php index.htm default.html Default.htm default.html Default.html default.shtml Default.shtml page1.html index.pl index.cgi index.php3 index.phtml home.htm home.html home.shtml index.wml

您可以编辑,使之符合您的需求。

You can edit that and make it fit your needs.

这篇关于为什么index.html的有优先的index.php?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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