如何使这种的.htaccess规则不区分大小写?大小写、规则、htaccess

2023-09-02 00:24:18 作者:一缕青丝绕纤尘

这是一个规则在我的.htaccess

This is a rule in my .htaccess

# those CSV files are under the DOCROOT ... so let's hide 'em
<FilesMatch ".CSV$">
 Order Allow,Deny
 Deny from all
</FilesMatch>

我却注意到,如果没有与CSV的小写或大小写混合的扩展名的文件,它会被规则忽略并显示出来。

I've noticed however that if there is a file with a lowercase or mixed case extension of CSV, it will be ignored by the rule and displayed.

如何让我这个不区分大小写?

How do I make this case insensitive?

我希望这不会回落到(?: CSV | CSV)。$(这我不知道,甚至会的工作,并没有按T涵盖所有基地)

I hope it doesn't come down to ".(?:CSV|csv)$" (which I'm not sure would even work, and doesn't cover all bases)

注意:的文件是在文档根目录下,并通过第三方服务上传的自动那里,所以我倒是preFER实施困扰他们的规则,我的最终替代。当初的 I 的这个站点设置了,虽然,我会去的文档根以上。

Note: The files are under the docroot, and are uploaded automatically there by a 3rd party service, so I'd prefer to implement a rule my end instead of bothering them. Had I set this site up though, I'd go for above the docroot.

感谢

推荐答案

的这个页面从Apache文档说,你可以做到这一点是这样的:

This page from the apache docs says that you can do it like this:

<FilesMatch .(?i:csv)$>