拒绝访问htaccess的多个文件 [英] Deny access to multiple files in htaccess
问题描述
我想通过htaccess的否认多个文件。
< FilesMatch(资料|注册|注册| .............. |)\ PHP>
为了允许,拒绝
所有否认
< / FilesMatch>
我有很多的文件(6个文件夹,每个样30个文件),我想拒绝访问,因此使用上面的方法通过输入他们一个个都需要时间。
我可以拒绝访问所有文件这样的文件夹?
<目录/ WWW / PHP /登录/页>
订购允许,拒绝
< /目录>
要多
< FilesMatch(富|酒吧|斗)\ PHP $。>
所有拒绝
< / FilesMatch>
或去重写规则( RewriteEngine叙述在
)
重写规则\(PSD |日志)$ - [NC,F]
要拒绝访问的所有文件夹:
重写规则^ WWW / PHP /登录/页 - [NC,F]
,或简单地将一个'所有'直接在该文件夹拒绝......
更新2015年:使用Apache 2.4或更高版本,在'一切'的将需要调整。
I'd like to deny multiple files through htaccess.
<FilesMatch (profile|reg|register|..............|)\.php>
order allow,deny
deny from all
</FilesMatch>
I have lots of files (6 folders with like 30 files each) that I want to deny access to, so using the method above by entering them one by one will take time.
Could I deny access to all files in the folders like this?
<Directory /www/php/login/pages>
Order Allow,Deny
</Directory>
To multiple
<FilesMatch "(foo|bar|doo)\.php$">
Deny from all
</FilesMatch>
or go for rewrite rules (RewriteEngine On
)
RewriteRule \.(psd|log)$ - [NC,F]
To deny access to all files in the folders:
rewriteRule ^www/php/login/pages - [NC,F]
or simply place a `Deny from all' directly in that folder...
Update 2015: Using Apache 2.4 or higher, the `Deny from all' would needs adjustment.
这篇关于拒绝访问htaccess的多个文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!