分享web开发知识

注册/登录|最近发布|今日推荐

主页 IT知识网页技术软件开发前端开发代码编程运营维护技术分享教程案例
当前位置:首页 > 运营维护

apache 目录网站显示indexs

发布时间:2023-09-06 01:27责任编辑:彭小芳关键词:apache

Apache Options Indexes FollowSymLinks详解

第一种方法

<Directory "E:\myvirtualhost\localhost">
   Options Indexes FollowSymLinks   #Options FollowSymLinks
   AllowOverride None
   Order allow,deny
   Allow from all
</Directory>

  去掉Indexes (Indexes 的作用就是当该目录下没有 index.html 文件时,就显示目录结构,去掉 Indexes,Apache 就不会显示该目录的列表了。)

第二种方法
        1、编辑httpd.conf文件

  找到如下内容:

DocumentRoot "E:/laragonvirtualhost"
<Directory "E:/laragonvirtualhost">
???  #
???  # 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.4/mod/core.html#options
???  # for more information.
???  #
???  Options Indexes FollowSymLinks Includes ExecCGI

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

???  #
???  # Controls who can get stuff from this server.
???  #
???  Require all granted
</Directory>

     在Options Indexes FollowSymLinks Includes ExecCGI 在Indexes前面加上 – 符号。
     即: Options -Indexes FollowSymLinks Includes ExecCGI 【在Indexes前,加 + 代表允许目录浏览;加 – 代表禁止目录浏览。】
   

 第三种方法

  可以在根目录的 .htaccess 文件中输入

  <Files *>
    Options -Indexes
  </Files>
  就可以阻止Apache 将目录结构列表出来。

apache 目录网站显示indexs

原文地址:http://www.cnblogs.com/shynshyn/p/7893036.html

知识推荐

我的编程学习网——分享web前端后端开发技术知识。 垃圾信息处理邮箱 tousu563@163.com 网站地图
icp备案号 闽ICP备2023006418号-8 不良信息举报平台 互联网安全管理备案 Copyright 2023 www.wodecom.cn All Rights Reserved