I have the following code in my security.conf file of apache
<DirectoryMatch "/(albums|attachment(s)?|upload(s)?)">
Options -ExecCGI
<IfModule php5_module>
php_flag engine off
</IfModule>
</DirectoryMatch>
This is to prevent php execution on any of the files inside these directories.
However, If I have this code, then a file with name attachment.php also does not executes the PHP code. I can modify the Regex to not include the attachment.php file. However, the question is why would the above DirectoryMatch cause my file not getting executed.
e.g. Paths:
Document Root: /var/www/html
Uploads / Attachments directories:
/var/www/uploads
/var/www/uploads/attachments
/var/www/uploads/albums
/var/www/html/attachments
attachment.php file: /var/www/html/attachment.php