Warm tip: This article is reproduced from serverfault.com, please click

apache-.htacess在一行上指定特定文件

(apache - .htacess specifying specific files on one line)

发布于 2020-11-28 09:38:24

我的.htaccess文件中包含以下内容:

# the following prevents display of the filetohide file
<files handler.php>
order allow,deny
deny from all
</files>

<files submit.php>
order allow,deny
deny from all
</files>

不能在一组标签内完成多个文件说明符,即:

<files submit.php|handler.php|otherfile.txt>
order allow,deny
deny from all
</files>

问候罗素

Questioner
Russell
Viewed
0
RavinderSingh13 2020-11-28 19:33:52

如果可以帮助你使用不同格式的多个文件名,请尝试以下方法(我尚未进行测试,但基于正则表达式编写了此文件)。

<files ~ "^((submit|handler)\.php)$|^(otherfile\.txt)$">
order allow,deny
deny from all
</files>