Regex .htaccess文件中的操作顺序

Regex .htaccess文件中的操作顺序,regex,apache,.htaccess,Regex,Apache,.htaccess,我想让每个人(0.0.0.0/0)都可以访问file1.php和file2.php,并且只允许从192.168.1.0/24子网访问特定目录中的所有其他文件。我尝试了以下配置,但无效: <Files ".htaccess"> deny from all </Files> <Files "file1.php"> order allow,deny allow from all </Files> <Files "file2.php"

我想让每个人(0.0.0.0/0)都可以访问file1.php和file2.php,并且只允许从192.168.1.0/24子网访问特定目录中的所有其他文件。我尝试了以下配置,但无效:

<Files ".htaccess">
  deny from all
</Files>

<Files "file1.php">
  order allow,deny
  allow from all
</Files>

<Files "file2.php">
  order allow,deny
  allow from all
</Files>

<FilesMatch ".*">
  order deny,allow
  deny from all
  allow from 192.168.1.
</FilesMatch>

全盘否定
命令允许,拒绝
通融
命令允许,拒绝
通融
命令拒绝,允许
全盘否定
允许从192.168.1开始。

结果:文件file1.php和file2.php仅从192.168.1.0/24子网打开。

如果将
*
规则放在第一位,会发生什么?我的猜测是,所有规则都是按顺序计算的,最后一个规则覆盖了第一个规则的结果

ApacheWeb服务器文档中明确记录了这一点,您应该阅读该文档。它写得很好,有很多例子