LocationMatch Regex for versioning

Posted by Aventus on Stack Overflow See other posts from Stack Overflow or by Aventus
Published on 2013-10-29T01:36:14Z Indexed on 2013/10/29 3:54 UTC
Read the original article Hit count: 94

Filed under:
|
|

I've tried using the docs but I'm quite new to regex. I've had success with others but the same method is not working for what I'm actually after.

I'm trying to send users to different servers based on the version number in the URL. This this case, older versions are to be sent to the new server for a particular service.

<LocationMatch "/(1.0|2.0|3.0)/appname">
    ...
</LocationMatch>

The following is working -

<LocationMatch "/1/appname">
    ...
</LocationMatch>
<LocationMatch "/2/appname">
    ...
</LocationMatch>

What I would love to achieve is sending all those major releases with a single tag -

<LocationMatch "/(1*|2*|3*)/appname">
    ...
</LocationMatch>

I've already referred the documentation at http://httpd.apache.org/docs/2.2/mod/core.html#locationmatch but unfortunately it doesn't cover my case with enough detail to help me.

© Stack Overflow or respective owner

Related posts about regex

Related posts about apache