I'm able to get the following configuration to work:-
Alias /webdoc /data/apps/jenkins/jobs
<Directory /data/apps/jenkins/jobs/[a-zA-Z0-9\-]+/workspace/target/docco>
Order allow,deny
Allow from all
</Directory>
With this configuration, I can make the following URL work
http://myserver/webdoc/HCMS-JS/workspace/target/docco/horizontal/index.html
However, I want to shorten the URL to something like this:-
http://myserver/webdoc/HCMS-JS/horizontal/index.html
I tried the following configuration, but I keep getting 404 when trying to hit the above link:-
AliasMatch ^/webdoc/([a-zA-Z0-9\-]+)/(.*) /data/apps/jenkins/jobs/$1/workspace/target/docco$2
<Directory /data/apps/jenkins/jobs/[a-zA-Z0-9\-]+/workspace/target/docco>
Order allow,deny
Allow from all
</Directory>
How do I get this to work? Thanks.
Your AliasMatch lacks a slash:
AliasMatch ^/webdoc/([a-zA-Z0-9\-]+)/(.*)
The first match here will be HCMS-JS
. The second will be horizontal/index.html
. That means that the result will be
/data/apps/jenkins/jobs/HCMS-JS/workspace/target/doccohorizontal/index.html
So you need to change the line to be
AliasMatch ^/webdoc/([a-zA-Z0-9\-]+)/(.*) /data/apps/jenkins/jobs/$1/workspace/target/docco/$2
to insert the slash that you didn't capture.
A good first place to look for these kinds of problems is the apache error log. It should tell you what file it is that it can't find.