DirectoryIndex directive
Syntax: DirectoryIndex local-url [local-url] ...
Default: DirectoryIndex index.html
Context: server config, virtual host, directory, .htaccess
Override: Indexes
Status: Base
Module: mod_dir
----------- 以下操作针对 httpd.conf 配置文件
Example:(默认)
DirectoryIndex index.html
#添加 index.htm 入默认访问页面
DirectoryIndex index.html index.htm
then a request for would return if it exists, or would list the directory if it did not.
Note that the documents do not need to be relative to the directory;
DirectoryIndex index.html index.txt /cgi-bin/index.pl
#上句当目录无 index.html index.txt 文件时,执行 /cgi-bin/index.pl 脚本。
would cause the CGI script /cgi-bin/index.pl to be executed if neither index.html or index.txt existed in a directory.
-----------------------
Apache下禁止目录浏览 没有首页的时候不显示列表
vi /etc/apache/httpd.conf进行编辑httpd.conf文件。
找到Options Indexes FollowSymLinks在Indexes前面加上"-"符号!
如果加"+"代表允许目录浏览,"-"代表禁止目录浏览。
找到换成
然后在找到 Options Indexes FollowSymLinks换成Options -Indexes FollowSymLinks
这样的话就属于整个Apache禁止目录浏览了
#
#
# Possible values for the Options directive are "None", "All",
# or any combination of:
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicated and important. Please see
#
# for more information.
#
Options -Indexes FollowSymLinks
这个是配置好的禁止整个Apache浏览
更简单的
Options None
# Options Indexes FollowSymLinks
Options None
AllowOverride None
Order allow,deny
Allow from all
-------------------------------另一种方法
编辑httpd.conf
把下面配置项改成
Options Indexes FollowSymlinks MultiViews
Options FollowSymlinks MultiViews
即拿掉Indexes,重新启动apache
阅读(184) | 评论(0) | 转发(0) |