.htaccess在一行中指定特定文件

3

以下是我在 .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>
1个回答

2

如果您需要处理多个不同格式的文件名,可以尝试以下方法(我还没有测试过,但是根据正则表达式编写了这篇文章)。

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

1
谢谢,看起来好像可以工作。我也做了第三个文件:<files ~ "^((submit|handler).php)$|^(data_base_update.txt)|^(thingsdata.txt)$"> - Russell

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接