问题
I used to have Alias as below for /CollabPortal14300 which was working fine
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>
But we trying to eliminate the numbers from the Alias and trying to use RegEx instead. So I switched to AliasMatch as below
AliasMatch /CollabPortal\d{5} D:/Dev/Projects/CollabPortal/CollabPortal/target/CollabPortal/
After switching AliasMatch /CollabPortal\d{5}
apache couldnt access the resources in D:/Dev/Projects/CollabPortal/CollabPortal/target/CollabPortal/
Below are the access logs
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
And in the error log I see
[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
Can someone please help me why AliasMatch is not working?
来源:https://stackoverflow.com/questions/26912490/aliasmatch-with-regex-notworking-in-apache-2-4