百分百源码网-让建站变得如此简单! 登录 注册 签到领金币!

主页 | 如何升级VIP | TAG标签

当前位置: 网站模板(百分百源码网)>电脑软件>操作系统> apache禁止文件列表实现方法
分享本文到:

apache禁止文件列表实现方法

发布时间:01/16 来源: 浏览: 关键词:
今天突然想起了要把网站文件列表显示功能禁止了,google,baidu了一下发现只要对Options Indexes FollowSymLinks和Options None就可以,现在我们来看看兄弟两之间的事情,

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

 代码如下

<Directory />

Options Indexes FollowSymLinks

AllowOverride None

Order deny,allow

Deny from all

</Directory>

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


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

 代码如下
<Directory   />
        Options   Indexes   FollowSymLinks
        AllowOverride   None
</Directory>


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

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

Options All -Indexes就可以了。


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

后来发现我应该是在我的

 代码如下

<Directory "E:www">
    #
    # 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

</Directory>

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

热门标签:dede模板 / destoon模板 / dedecms模版 / 织梦模板
责任编辑:
打赏

打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,你说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

百分百源码网 建议打赏1~10元,土豪随意,感谢您的阅读!

共有4人阅读,期待你的评论!发表评论
昵称: 网址: 验证码: 点击我更换图片
最新评论

本文标签

广告赞助



订阅获得更多模板

本文标签

广告赞助

订阅获得更多模板