How do i use wildcards, boolean and regular expressions in apache?
-
The <Directory>, <Files>, and <Location> can be used with wildcards
Matches any (*) user's public_html directory
<Directory "/home/*/public_html"> Options Indexes </Directory>
The <DirectoryMatch>, <FilesMatch>, and <LocationMatch> use the Perl Compatible regular expression library (PCRE)
Using (?), ($), and (.)
<FilesMatch "\.(?i:gif|jpe?g|png)$"> Require all denied </FilesMatch>
Combination of PCRE & use of mod_rewrite
<DirectoryMatch "ˆ/var/www/combined/(?<SITENAME>[ˆ/]+)"> require ldap-group "cn=%{env:MATCH_SITENAME},ou=combined,o=Example" </DirectoryMatch>
Used similar to "if" in a shell script, you can use the negative with the "!" operator
<If "!(%{HTTP_REFERER} -strmatch ’http://www.example.com/*’)"> Require all denied </If>
© Lightnetics 2024