一聚教程网:一个值得你收藏的教程网站

最新下载

热门教程

apache禁止文件列表实现方法

时间:2012-05-12 编辑:简简单单 来源:一聚教程网

在apache安装目录下找到httpd.conf文件,用记事本打开,通过查找功能找到

 代码如下 复制代码

Options Indexes FollowSymLinks

AllowOverride None

Order deny,allow

Deny from all

这一段,将Options Indexes FollowSymLinks修改为Options None


把下面的Options   Indexes   FollowSymLinks改为Options  FollowSymLinks就不会浏览目录了,加上就又可以浏览目录了

 代码如下 复制代码

        Options   Indexes   FollowSymLinks
        AllowOverride   None


在httpd.conf中有两个这样的段落都要这样子修改,完成后保存,重启apache即可

如果你不是服务器肯定没有修改httpd.conf的权限,那么我们只要按下面操作这样,最简单的办法就是在要禁止文件列表的目录下建立.htaccess文件,然后在里面加入一行:

Options All -Indexes就可以了。


注意:我自己在按面方法时出现个小问题,就是按()它的目录设置是无效的

后来发现我应该是在我的

 代码如下 复制代码


    #
    # 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
    # http://httpd.apache.org/docs/2.2/mod/core.html#options
    # for more information.
    #
    #Options Indexes FollowSymLinks
     Options none

    #
    # AllowOverride controls what directives may be placed in .htaccess files.
    # It can be "All", "None", or any combination of the keywords:
    #   Options FileInfo AuthConfig Limit
    #
    AllowOverride None

    #
    # Controls who can get stuff from this server.
    #
    Order allow,deny
    Allow from all

这样就完全实现了禁止目录显示列表了

热门栏目