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

标签 apache .htaccess mod-rewrite

我的 .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>

最佳答案

如果这对不同格式的多个文件名有帮助,​​请你试试看(我还没有测试这个但是基于正则表达式写的)。

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

关于apache - .htaccess 在一行中指定特定文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65048199/

相关文章:

.htaccess - 测试 gzip 是否在本地工作

regex - htaccess 不存在的子域到主域重定向

apache - 如何才能mod_rewrite并保留查询字符串?

php - mod_rewrite : Demystifying RewriteBase (once and for all)

apache - .htaccess:检查查询字符串是否具有特定值或重定向它

html - 如何缓存我的图标

php - 如何将 example.com/index.php#anchor 的 URL 重写为 example.com/anchor?

php - 在反向代理后面运行的 symfony 应用程序的 URL

php - csv 到 excel 转换

php - Homebrews php56-imagick 模块由于 liblzma 无法加载