最終更新日: 2018-02-17
デフォルトでは表示されるようだがこれを非表示にしたい場合。
httpd.conf の、Options で Indexes というのが並んでいるのを削除する。
一例
〜
# Further relax access to the default document root:
<Directory "/var/www/html">
    #
    # 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
〜
</Directory>
〜
↓
〜
    Options FollowSymLinks
〜
公式ドキュメントの箇所は以下。
core - Apache HTTP Server Version 2.4 → Options Directive
なおそこでは、Options の 文法は以下だとしている。
Syntax: Options [+|-]option [[+|-]option] ...
以下では、ディレクトリを非表示にするには Indexes を -Indexes にするとある。
@IT:Apacheでファイル一覧を表示させないようにするには
以下(2015年)では、上の記事(2005年)の通りではエラーになるので、さらに横の FollowSymLinks に + を付けないといけないとある。
Apache2でディレクトリ内のファイル一覧を非表示にする
他も見たが、前述のように Indexes を削除すればいけるようである。