禁止Apache显示目录索引,禁止Apache显示目录结构列表,禁止Apache浏览目录,这是网上提问比较多的,其实都是一个意思。下面说下禁止禁止Apache显示目录索引的常见的3种方法。

要实现禁止Apache显示目录索引,只需将 Option 中的 Indexes 去掉即可。

1)修改目录配置:

<directory "D:/Apache/blog.phpha.com">
Options Indexes FollowSymLinks # 修改为: Options  FollowSymLinks
    AllowOverride None
    Order allow,deny
    Allow from all
</directory>
 

只需要将上面代码中的 Indexes 去掉,就可以禁止 Apache 显示该目录结构。用户就不会看到该目录下的文件和子目录列表了。Indexes 的作用就是当该目录下没有 index.html 文件时,就显示目录结构,去掉 Indexes ,Apache 就不会显示该目录的列表了。
2)修改Apache配置文件[httpd.conf]
搜索“Options Indexes FollowSymLinks”,修改为“Options -Indexes FollowSymLinks”即可。
在Options Indexes FollowSymLinks在Indexes前面加上 – 符号。备注:在Indexes前,加 + 代表允许目录浏览;加 – 代表禁止目录浏览。这样的话就属于整个Apache禁止目录浏览了。
如果是配置虚拟机,则如下:

<virtualHost *>
    <directory "../vhosts/blog.phpha.com">
        Options -Indexes FollowSymLinks # 修改为 -Indexes 即可
    </directory>
    ServerAdmin mail@phpha.com
    DocumentRoot "../vhosts/blog.phpha.com"
    ServerName shopex:80
    ServerAlias blog.phpha.com
    ErrorLog logs/blog.phpha.com-error_log
</virtualHost>
 

3)通过.htaccess文件
可以在根目录新建或修改 .htaccess 文件中添加

<files *>
Options -Indexes
</files>

就可以禁止Apache显示目录索引。

禁止Apache显示目录索引的常见方法的更多相关文章

  1. 禁止apache显示目录索引的常见方法(apache禁止列目录)

    禁止Apache显示目录索引,禁止Apache显示目录结构列表,禁止Apache浏览目录,这是网上提问比较多的,其实都是一个意思.下面说下禁止禁止Apache显示目录索引的常见的3种方法. 要实现禁止 ...

  2. 禁止apache显示目录索引 apache禁止列目录

    禁止Apache显示目录索引的常见的3种方法. 要实现禁止Apache显示目录索引,只需将Option中的Indexes去掉即可. 禁止Apache显示目录索引,禁止Apache显示目录结构列表,禁止 ...

  3. 禁止apache显示目录索引

    1)修改目录配置: 复制代码 代码如下: <Directory "D:/Apache/blog.phpha.com">Options Indexes FollowSym ...

  4. Apache显示目录列表及icons目录的问题

    今天想部署下开源项目pig,发现它的mysql需要5.7.8 +,为了能支持多个版本并且可以方便切换,所以选择了phpstudy_pro 刚开始Apache不支持目录访问 修改配置 <Virtu ...

  5. centos中设置apache显示目录列表

    apache中显示目录列表 在http.conf中加入如下代码(如有虚拟主机配置,加在虚拟主机配置段内),并把主目录内的index.pho,index.html,index.htm文件删除 复制代码  ...

  6. linux 中只显示目录的几种方法

    ls 参数 -a 表示显示所有文件,包含隐藏文件-d 表示显示目录自身的属性,而不是目录中的内容-F 选项会在显示目录条目时,在目录后加一个/ ls -l total 8 drwxrwxr-x 2 r ...

  7. Appserv(Apache) 设置网页不显示目录(索引)

    首先在appserv安装目录下找到httpd.conf文件 ./AppServ/Apache24/conf/httpd.conf 打开文件,找到 Options Indexes FollowSymLi ...

  8. Node学习之(第三章:仿Apache显示目录列表的功能)

    前言 今天咱们用Node.js中的核心模块以及上节学习的模板引擎art-template来实现服务器软件Apache的大体功能.用过Apache的朋友都知道,我们只需把本地文件放置在Apache的ww ...

  9. apache显示目录文件列表

    在apache服务器下访问一个目录,如果没有index.html/index.php,则会报错. 为了访问文件夹: 1. 在 /var/www/html 目录下新建 /d/ mkdir d 2.  t ...

随机推荐

  1. ZooKeeper安装方法具体解释

    ZooKeeper安装方式分为两种,一种为单机模式.一个为集群模式,集群模式须要事先正确配置hadoop集群,安装方法參考hadoop-1.2.1安装方法具体解释 单机模式安装: 1.上传并解压zoo ...

  2. springmvc 日期解决方案(三)使用jackson

    引入jar包: <dependency> <groupId>org.codehaus.jackson</groupId> <artifactId>jac ...

  3. vmware-Binary translation is incompatible with long mode on this platform

    解决方法:Binary translation is incompatible with long mode on this platform. Disabling long mode. Withou ...

  4. 【LeetCode】162. Find Peak Element (3 solutions)

    Find Peak Element A peak element is an element that is greater than its neighbors. Given an input ar ...

  5. [译]聊聊C#中的泛型的使用(新手勿入) Seaching TreeVIew WPF 可编辑树Ztree的使用(包括对后台数据库的增删改查) 字段和属性的区别 C# 遍历Dictionary并修改其中的Value 学习笔记——异步 程序员常说的「哈希表」是个什么鬼?

    [译]聊聊C#中的泛型的使用(新手勿入)   写在前面 今天忙里偷闲在浏览外文的时候看到一篇讲C#中泛型的使用的文章,因此加上本人的理解以及四级没过的英语水平斗胆给大伙进行了翻译,当然在翻译的过程中发 ...

  6. (Spring Boot框架)快速入门

    Spring Boot 系列文章推荐 Spring Boot 入门 Spring Boot 属性配置和使用 Spring Boot 集成MyBatis Spring Boot 静态资源处理 今天介绍一 ...

  7. Atitit.软件开发概念说明--io系统区--特殊文件名称保存最佳实践文件名称编码...filenameEncode

    Atitit.软件开发概念说明--io系统区--特殊文件名称保存最佳实践文件名称编码...filenameEncode 不个网页title保存成个个文件的时候儿有无效字符的问题... 通常两个处理方式 ...

  8. Atitit. 委托的本质 c#.net java php的比较

    Atitit.class 与type的区别,抽象的级别 class, delegate,interface委托的本质 1. 委托是粒度更细的接口 1 2. 委托模式 1 3. Java中的委托 1 4 ...

  9. SignalTap ii的使用

    1.实现原理 SignalTap II获取实时数据的原理是在工程中引入Megafunction中的ELA(Embedded Logic Analyzer),以预先设定的时钟采样实时数据,并存储于FPG ...

  10. CControlLayer

    #ifndef __CONTROLLAYER_H__ #define __CONTROLLAYER_H__ #include "XWidget.h" class CMapDialo ...