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

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

问题描述

我在服务器上有一个网站.主页是example.com/index.php.

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

好的,我上传了一个名为 index.html 的文件到服务器(根目录),当我在浏览器的 URL 栏中输入我网站的域时,我很惊讶,因为加载了 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?

推荐答案

这实际上取决于您使用的服务器.这是配置问题.并不是说使用 html 与 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 变体优先,因为它是最基本的网络格式.

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天全站免登陆