问题描述
我在我的.htaccess文件下面一行:
I have the following line in my .htaccess file:
DirectoryIndex index.html index.php
每次我去的index.php需要我的index.html。是否有可能让这两个,但留下的index.html默认为用户访问www.domain.com?
Everytime I go to index.php it takes me to index.html. Is it possible to allow for both, but leave index.html the default for users visiting www.domain.com?
推荐答案
默认情况下,DirectoryIndex的设置为:
By default, the DirectoryIndex is set to:
DirectoryIndex index.html index.htm default.htm index.php index.php3 index.phtml index.php5 index.shtml mwindex.phtml
Apache会寻找每一个上面的文件,为了和服务于第一个发现当访问者请求只是一个目录。如果Web服务器发现在当前目录中匹配DirectoryIndex指令的名称,没有文件,那么目录列表会显示在浏览器中,显示当前目录中的所有文件。
Apache will look for each of the above files, in order, and serve the first one it finds when a visitor requests just a directory. If the webserver finds no files in the current directory that match names in the DirectoryIndex directive, then a directory listing will be displayed to the browser, showing all files in the current directory.
的顺序应该是的DirectoryIndex index.html的的index.php
//默认的index.html
The order should be DirectoryIndex index.html index.php
// default is index.html
参考: Here.
这篇关于请index.html的默认,但允许index.php文件被访问,如果键入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!