使用正则表达式的AliasMatch在Apache 2.4中不起作用

时间:2014-11-13 15:30:52

标签: apache httpd.conf vhosts mod-alias apache2.4

我曾经为/ CollabPortal14300提供了如下Alias

Alias /CollabPortal14300 D:/Dev/Projects/CollabPortal/CollabPortal/target/CollabPortal/
Alias /dc/api/entity/EmailDocument/\d+/DocumentVersion/1\.0 D:/Dev/Projects/CollabPortal/CollabPortal/target/CollabPortal/core/html/blank.html

<Directory D:/Dev/Projects/CollabPortal/CollabPortal/target/CollabPortal>
    Options Indexes FollowSymLinks Includes ExecCGI
    Require all denied
    <FilesMatch "\.(gif|jpe?g|jpg|png|js|css|ico)$">
        Require all Granted
    </FilesMatch>
    ExpiresActive On
    ExpiresByType image/gif "access plus 10 years"
    ExpiresByType image/png "access plus 10 years"
    ExpiresByType text/css "access plus 10 years"
    ExpiresByType text/javascript "access plus 10 years"
    ExpiresByType application/javascript "access plus 10 years"
</Directory>

但我们试图从Alias中删除数字并尝试使用RegEx。所以我切换到AliasMatch,如下所示

AliasMatch /CollabPortal\d{5} D:/Dev/Projects/CollabPortal/CollabPortal/target/CollabPortal/

切换AliasMatch /CollabPortal\d{5}后,apache无法访问D:/Dev/Projects/CollabPortal/CollabPortal/target/CollabPortal/

中的资源

以下是访问日志

fe80::f48e:b1a2:4f75:7c9c - - [12/Nov/2014:15:10:52 -0600] "GET /CollabPortal14300/core/css/styles.css HTTP/1.1" 403 246
fe80::f48e:b1a2:4f75:7c9c - - [12/Nov/2014:15:10:52 -0600] "GET /CollabPortal14300/core/js/lib/jquery.js HTTP/1.1" 403 248
fe80::f48e:b1a2:4f75:7c9c - - [12/Nov/2014:15:10:52 -0600] "GET /CollabPortal14300/core/js/lib/jquery-migrate-1.1.1.js HTTP/1.1" 403 262
fe80::f48e:b1a2:4f75:7c9c - - [12/Nov/2014:15:10:52 -0600] "GET /CollabPortal14300/core/js/lib/jquery-ui.js HTTP/1.1" 403 251
fe80::f48e:b1a2:4f75:7c9c - - [12/Nov/2014:15:10:52 -0600] "GET /CollabPortal14300/core/js/lib/jquery.treeview.js HTTP/1.1" 403 257
fe80::f48e:b1a2:4f75:7c9c - - [12/Nov/2014:15:10:52 -0600] "GET /CollabPortal14300/core/js/lib/jquery.treeview.async.js HTTP/1.1" 403 263

在错误日志中我看到了

[Thu Nov 13 18:21:18.278759 2014] [authz_core:error] [pid 78888:tid 928] [client fe80::f48e:b1a2:4f75:7c9c:58633] AH01630: client denied by server configuration: D:/Dev/Projects/CollabPortal/CollabPortal/target/CollabPortal/, referer: https://dc-rpalle7/CollabPortal/enduser/listscreens/show.do

有人可以帮我解释为什么AliasMatch不起作用吗?

0 个答案:

没有答案