禁止使用htaccess的目录浏览 [英] Disable Directory Browsing using htaccess
问题描述
在我的服务器我有一系列的文件夹中。我会拒绝访问所有文件夹。我能怎么做?我有什么规则来使用?
in my server I have a series of folders. I would deny the access to all this folders. How can I do? What rule I have to use?
推荐答案
在你的.htaccess根添加一行:
add one line in your .htaccess root:
deny from all
@QUESTION:
如果你想保留访问自己:
if you want to retain access for yourself:
allow from 192.168.1.1
替补多在你的真实IP为一个我给的例子。
subsitute in your real IP for the one i gave in the example.
这样一起:
deny from all
allow from YOUR_IP
@问题2:
如果你拒绝访问的目录,你是拒绝访问所有节点在该目录中,如页面。如果你说你要拒绝访问的文件夹中同一级别的目录页,将htaccess的该文件夹内(简单的)
if you deny access to a directory, you are denying access to all of the nodes in that directory like the "pages". if you are saying you want to deny access to a folder in the same level directory as the pages, move the htaccess to inside of that folder (simplest)
@EDIT:
打开.htacces文件
寻找选项指标
如果选择指数存在修改它选项-Indexes或者添加选项-Indexes 作为新行
目录浏览功能应该禁用现在
Open your .htacces file
Look for Options Indexes
If Options Indexes exists modify it to Options -Indexes or else add Options -Indexes as a new line
The directory browsing feature should be disable by now
<一个href="http://www.techiecorner.com/106/how-to-disable-directory-browsing-using-htaccess-apache-web-server/">http://www.techiecorner.com/106/how-to-disable-directory-browsing-using-htaccess-apache-web-server/
这篇关于禁止使用htaccess的目录浏览的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!