0

I have the following directive in my httpd.conf:

<DirectoryMatch ^/path/(?P<SI>[^/]+)/logs/bibi>
    php_admin_value open_basedir /path/?P=<SI>/
</DirectoryMatch>

The pattern recognition for (?P<SI>[^/]+) works, but I don't find how to use it back with the instructions within the directive. The site http://httpd.apache.org/docs/current/sections.html is very little helpful (syntax not working with my 2.2 apache) but at least they mention the possibility:

Regular expressions containing named groups and backreferences are added to the environment with the corresponding name in uppercase. This allows elements of filename paths and URLs to be referenced from within expressions and modules like mod_rewrite.

<DirectoryMatch ^/var/www/combined/(?<SITENAME>[^/]+)>
    require ldap-group cn=%{env:SITENAME},ou=combined,o=Example 
</DirectoryMatch>

Any idea? I want to use a named group into instructions.

2

The document to which you refer is for the current version of Apache. Within the <DirectoryMatch> documentation, there is clarification

From 2.4.8 onwards, named groups and backreferences are captured and written to the environment with the corresponding name prefixed with "MATCH_" and in upper case...

As you're using a version of Apache earlier than 2.4.8 you won't have access to this facility.

2
  • you are right, I overlooked the version problem...
    – Sebas
    Feb 6 '14 at 17:17
  • if you did have > apache 2.4.8, how would you do this... Apr 25 '17 at 23:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.