如何禁用目录浏览? [英] How do I disable directory browsing?

查看:36
本文介绍了如何禁用目录浏览?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想禁用/galerias 文件夹和所有子目录的目录浏览

I want to disable directory browsing of /galerias folder and all subdirectories

/galerias/409 的索引

Index of /galerias/409

* Parent Directory
* i1269372986681.jpg
* i1269372986682.jpg
* i1269372988680.jpg

推荐答案

创建一个包含以下行的 .htaccess 文件:

Create an .htaccess file containing the following line:

Options -Indexes

这是一种选择.另一种选择是编辑您的 apache 配置文件.

That is one option. Another option is editing your apache configuration file.

为此,您首先需要使用以下命令打开它:

In order to do so, you first need to open it with the command:

vim /etc/httpd/conf/httpd.conf

然后找到这一行:Options Indexes FollowSymLinks

Then find the line: Options Indexes FollowSymLinks

将该行更改为:Options FollowSymLinks

Change that line to: Options FollowSymLinks

最后保存退出文件,用这个命令重启apache服务器:

Lastly save and exit the file, and restart apache server with this command:

sudo service httpd restart

(你有一个带有截图的指南这里.)

(You have a guide with screenshots here.)

这篇关于如何禁用目录浏览?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆