htaccess的&LT;目录&GT;所有否认 [英] htaccess <Directory> deny from all
问题描述
我一直在清理我的项目最近。我在根目录和其他6人主要的.htaccess。其中5人跑了选项-Indexes
,我没有看到任何允许目录浏览左右的任意点移到了主之一。所以现在我只有2 .htaccess文件。主要的,一个在 /系统
持有
I've been cleaning up my project lately. I have a main .htaccess in the root directory and 6 others. 5 of them ran Options -Indexes
which i didn't see anypoint of allowing any Directory viewing so moved that to the main one. so now i only have 2 .htaccess files. the main and one in /system
which holds
# Block External Access
deny from all
所以我想运行在 /系统
只能从主。所以我删除了一个在/系统,并添加
So i wanted to run that on /system
only from within the main. So i deleted the one in /system and added
# Block External Access
<Directory "/system/">
deny from all
</Directory>
我的主要.htaccess文件留1!
to my main .htaccess file leaving 1!
但现在我得到一个
内部服务器错误
服务器遇到一个内部错误或配置错误, 无法完成您的请求。
The server encountered an internal error or misconfiguration and was unable to complete your request.
请与服务器管理员联系,站长@ localhost,且 通知他们错误发生的时间,以及任何你可能 这样做可能造成的错误。
Please contact the server administrator, webmaster@localhost and inform them of the time the error occurred, and anything you might have done that may have caused the error.
这个错误的详细信息,可在服务器错误可用 登录。
More information about this error may be available in the server error log.
的Apache / 2.2.17(Ubuntu的)服务器在10.0.1.5端口80
Apache/2.2.17 (Ubuntu) Server at 10.0.1.5 Port 80
我们的目标是阻止读取/系统中的任何文件和它的子目录的,但允许观看一切都来自一个的.htaccess
文件为整个项目。我如何才能解决这个问题的任何想法?我做了一些谷歌搜索,但不能真正拿出什么。
The goal is to block reading any files in /system and it's sub directory's but allow viewing of everything else all from one .htaccess
file for the whole project. Any ideas on how i can fix this? I did some Google searches but couldn't really come out with anything.
推荐答案
您不能使用目录指令在.htaccess。但是,如果你在/系统目录中的.htaccess文件并将其放置在它下面,你会得到相同的结果。
You cannot use the Directory directive in .htaccess. However if you create a .htaccess file in the /system directory and place the following in it, you will get the same result
#place this in /system/.htaccess as you had before
deny from all
这篇关于htaccess的&LT;目录&GT;所有否认的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!