httpd 阻止访问目录中的所有文件类型,但允许访问单个文件。

httpd block access for all file types in a directory but allow access to a single file.

在我的站点中,我有一个目录 /here/is/the/dir/path

我想允许访问子目录中的单个文件 示例:test/testfile.xml 但想拒绝访问其他文件列表 (jsp, class, jar, xml )

我有这个我想放在 httpd.conf

    <Directory /here/is/the/dir/path >

    <FilesMatch "test.xml">
    Order Allow,Deny 
    Allow from All 
    Deny from None 
    </FilesMatch>

    <FilesMatch "+\.(jsp|class|jar|xml)">
    order allow,deny
    deny from all
    </FilesMatch>

    </Directory>

这是正确的写法吗?有没有办法将我的两个文件匹配语句组合成一个语句?

所述方法已经过测试并且有效。