[英]Deny access to multiple files in htaccess
I'd like to deny multiple files through htaccess. 我想通过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. 我有很多文件(6个文件夹,每个文件夹有30个文件)我想拒绝访问,所以使用上面的方法逐个输入它们需要时间。
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
) 或者去改写规则(
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 . 2015年更新:使用Apache 2.4或更高版本,“全部拒绝” 需要调整 。
You would need to add "deny from all" like your initial approach, but yes you can. 您需要像初始方法一样添加“拒绝所有人”,但是可以。
Scroll down in the documentation for the syntax you are looking for: http://httpd.apache.org/docs/2.2/mod/core.html#directory 在文档中向下滚动查找您要查找的语法: http : //httpd.apache.org/docs/2.2/mod/core.html#directory
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.