我们知道apache的配置文件httpd.conf可以配置网站目录的默认主页。配置文件该部分定义如下:

#DirectoryIndex: sets the file that Apache will serve if a directory is requested.

<IfModule dir_module>
DirectoryIndex index.php index.php3 index.html index.htm
</IfModule>

同理htaccess中的DirectoryIndex 同样可以配置网站目录的默认主页,例如有的服务器默认index.html为主页,而通过DirectoryIndex 则可以设定任意命名的文件为首页。

DirectoryIndex psz.php index.php index.php3 index.html index.htm

服务器的工作流程:首先在目录中找psz.php,有的话就默认为主页,没有的话就继续找下一个,优先顺序为从左往右。

posted on 2015-04-21 09:50  撒得一地  阅读(1146)  评论(0编辑  收藏  举报