[英].htaccess deny access to specific files? more than one
我可以使用.htaccess禁用對文件的訪問,但我不知道如何禁止查看多個文件(直接,不是來自包含)
它們是.php所以我無法禁用文件類型(就像在線的唯一教程說的那樣..)
<FILES ... ?
</FILES>
或者其他東西..例如“home.php,file.php,test.php”如何禁止訪問帶有該標簽的所有三個文件? 或類似的,請幫忙!
如果要基於正則表達式排除文件,可以使用FilesMatch而不是Files,例如:
<FilesMatch ^((home|test|file)\.php$|mysecretfolder|asecretpicture\.jpe?g)$>
...
</FilesMatch>
看起來你必須逐個排除這些文件:
<files home.php>
Deny/Allow/Whatever
</files>
<files file.php>
...
您可以在<files>
或something*
使用*.gif
,但由於home.php,file.php和test.php實際上不能與“*”組合,這可能是唯一的方法。
自apache 2.4
<FilesMatch "\.htaccess|config\.php">
Require all denied
</FilesMatch>
代替
<FilesMatch "\.htaccess|config\.php">
Order allow,deny
Deny from all
</FilesMatch>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.