.htaccess 拒绝访问特定文件?超过一个 [英] .htaccess deny access to specific files? more than one
本文介绍了.htaccess 拒绝访问特定文件?超过一个的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我可以禁止使用 .htaccess 访问文件,但我不知道如何禁止查看多个文件(直接,而不是从包含中)
I am able to disable access to a file with .htaccess, but I don't know how to disallow multiple files to be viewed (directly, not from includes)
它们是 .php,所以我不能禁用文件类型(就像网上唯一的教程说..)
They are .php so I can't disable a file type (like the only tutorials online say..)
<FILES ... ?
</FILES>
或者其他东西..例如home.php, file.php, test.php"我如何禁止访问带有该标签的所有三个文件?或类似的,请帮助!
Or something.. For example "home.php, file.php , test.php" how do I disallow access to all three files with that tag? or similar, help please!
推荐答案
如果你想根据正则表达式排除文件,你可以使用 FilesMatch 而不是 Files,例如:
If you want to exclude files based on regular expressions, you could use FilesMatch instead of Files, e.g.:
<FilesMatch ^((home|test|file)\.php$|mysecretfolder|asecretpicture\.jpe?g)$>
...
</FilesMatch>
这篇关于.htaccess 拒绝访问特定文件?超过一个的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文