Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/.htaccess/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Apache中index.php之前的简介页_Apache_.htaccess - Fatal编程技术网

Apache中index.php之前的简介页

Apache中index.php之前的简介页,apache,.htaccess,Apache,.htaccess,我想在根目录中的index.php页面之前设置简介页面。我的web服务器是Apache。我将此代码放在我的htaccess文件中: DirectoryIndex i.html index.php 这是i.htmlcode: <!DOCTYPE html> <html> <head> <title>Personal Website</title> </head> <body> <a href="ind

我想在根目录中的
index.php
页面之前设置简介页面。我的web服务器是Apache。我将此代码放在我的
htaccess
文件中:

DirectoryIndex i.html index.php
这是
i.html
code:

<!DOCTYPE html>
<html>

<head>
<title>Personal Website</title>
</head>

<body>

<a href="index.php">Enter</a>

</body>

</html>

个人网站
但当我点击链接时,页面仍然在
I.html
上,我无法进入
index.php

怎么了


有更好的方法吗?

为什么不像通常那样将索引设置为欢迎页面,然后将链接设置为其他页面?。我看不出你做的有什么不对。。。。嗯

尝试放置index.html或index.htm并保留htacess内容,因为服务器通常会尝试在php文件之前打开html文件


因此,使用index.htm或index.html通常适用于欢迎页面,因为您通常不需要配置任何东西,只需将文件放在那里,它就会覆盖index.php作为起始页面。

我知道这很旧,但以下内容在.htaccess文件中对我有用:

DirectoryIndex index.html index.php
仅供参考,对.htaccess的更改不需要重新启动Apache,应该立即进行。您可以尝试在.htaccess中搜索DirectoryIndex,以确保它不在其中多次


我知道你的问题涉及I.html。我不知道这是否有区别,但您可以轻松地将其切换到index.html查看。

我的网站使用了一些CMS,我无法更改index.php,必须将简介链接到主页,这就是设置简介页面的原因。哦,我明白您的意思,我以前在Joomla中遇到过这个问题。通常添加index.html是有效的,因为服务器会在到达index.phmm之前到达index.php。这很奇怪,即使存在index.html,它是否也会转到index.php?。当您在那里有i.html并单击enter链接时,是否存在任何类型的错误?当单击链接时,它必须转到index.php,但会返回i.html。而且没有任何错误。