Is it possible to get the matched regex from within the apache LocationMatch directive?
- by tftd
I'm wondering if the following code should be working:
<LocationMatch "/(.*)([/])?(.*)">
Order allow,deny
Allow from all
AuthType Basic
AuthName "Git"
AuthUserFile /git/.htpasswd
AuthGroupFile /git/.htgroup
Require group $1
</LocationMatch>
What I am trying to achieve with this is to require a group based on the first regex variable. So if the user goes to http://localhost/a-repository-name he has to be in the group a-repository-name to be able to open the url.
For some reason I can't get this code working and apache returns:
Authorization of user **** to access /a-repository-name failed, reason: user is not part of the 'require'ed group(s).
I guess it's not matching against the proper variable at Require group $1.
Is this the right way to be done or I'm missing something?