目前我们有:
# ----------------------------------------+++++---- <FilesMatch "(?i)(\.tpl|.twig|\.ini|\.log|\.txt)"> Require all denied </FilesMatch>
但是我们需要允许robots.txt和ads.txt。如何做到这一点?
robots.txt
ads.txt
sg24os4d1#
试试这个:
(?i)(\.tpl|.twig|\.ini|\.log|(?<!robots|ads)\.txt)$
(?<!robots|ads)\.txt而不是robots,或者ads后面跟着.txt。$行/字符串的结尾。参见regex demo
(?<!robots|ads)\.txt
robots
ads
.txt
$
1条答案
按热度按时间sg24os4d1#
试试这个:
(?<!robots|ads)\.txt
而不是robots
,或者ads
后面跟着.txt
。$
行/字符串的结尾。参见regex demo