Shorten URL using AliasMatch

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.

Answers


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.


Need Your Help

How can i get Ip addresses of other Wifi enabled devices by programmatically on the same network?

android ip ip-address android-wifi

In my Android mobile, I clicked from the phone and saw settings-> Wireless Controls->Wifi Settings and tapped on the network i have connected to. It popped up a Dialog with network status, level, s...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.