1

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

6
  • Where's that file reside? Sep 18, 2013 at 6:10
  • Do you mean attachment.php file? It resides in a separate directory. It is not in any of the above directories.
    – Virendra
    Sep 18, 2013 at 16:47
  • Strange that it's being treated as a directory, but.. we should be able to work around that. Are all of those directories (albums, attachments, etc) in the same place? Sep 18, 2013 at 16:59
  • They may or may not be in same location. They can be anywhere including the directory in which the attachment.php file resides.
    – Virendra
    Sep 19, 2013 at 0:45
  • You should probably give some example paths.
    – covener
    Sep 22, 2013 at 16:59

0

You must log in to answer this question.

Browse other questions tagged .