2

Is there any way to get matched substring from LocationMatch and use it as part of configuration? I have several similar sites that uses apache Basic auth and want to check against "sitename".passwd files..

in code I mean this but working:

<LocationMatch /([^/]+)/login>
  AuthType Basic
  ...
  AuthUserFile /var/sitepwds/$1.passwd
</LocationMatch>
Pentium10
  • 204,586
  • 122
  • 423
  • 502
Ficik
  • 149
  • 1
  • 9

1 Answers1

1

Use mod_macro for that.

Write:

<Macro MyMacro $name>
<LocationMatch /$name/login>
  AuthType Basic
  ...
  AuthUserFile /var/sitepwds/$name.passwd
</LocationMatch>
</Macro>

and use it like:

Use MyMacro site1
Use MyMacro site2
Use MyMacro site3
...
Achimnol
  • 1,551
  • 3
  • 19
  • 31