Looking for some guidance on how I can match a specific file in a wildcard of directories.
Example - the rule needs to apply to:
/path/to/folder1/directory/index.php
/path/to/folder2/directory/index.php
/path/to/folder3/directory/index.php
Here is an example of the configuration made. The idea is to ensure that they are prompted for a username/password if this file is accessed:
<FilesMatch "/path/to/*/directory/index.php">
AuthName "Login"
AuthType Basic
AuthUserFile /path/to/.htpasswd
require valid-user
However, that doesn't seem to be working.
EDIT
After the first answer response, I changed the code. The primary purpose of this is to ensure that if anyone accesses the administrator/index.php file, they are asked for username and password via mod_security. Any other index.php files recursive to the administrator directory should not be prompted:
<Directory "/location/to/.*/administrator">
<Files "index.php">
AuthName "Login"
AuthType Basic
AuthUserFile /path/to/.htpasswd
require valid-user
</Files>
</Directory>
Does that do the trick?