ApacheのIndexesが無効にならないとき
2021/07/14
ApacheのOptionsのIndexesを無効にしたい場合、うちの場合、VirtualHostディレクティブで、
<Directory "/var/www/html/環境名">
AllowOverride All
Options +FollowSymLinks -Indexes
DirectoryIndex index.php index.html
Require all granted
</Directory>とすることが多いですが、/icons/でアクセスすると、なぜかIndexesが効いてしまい、表示されてしまうことがありました。
Apacheのほかの設定を見てみると、autoindex.confの中に、該当の設定があるみたいだったので、
#Alias /icons/ "/usr/share/httpd/icons/"
#
#<Directory "/usr/share/httpd/icons">
# #Options Indexes MultiViews FollowSymlinks
# Options MultiViews FollowSymlinks
# AllowOverride None
# Require all granted
#</Directory>その該当箇所をコメントアウトすることで、/icons/も404ページに遷移するようになりました。