Apache 2 .htaccess matching all sub directories of current directory

.htaccessapache-2.2directory

I want to disable the php engine in all directories below the current one.

I have tried using <Directory> and <DirectoryMatch> but cannot find the correct regex syntax for matching just sub directories.

Example directory structure:

files/folder1/
files/folder2/
files/folder3/folder3a

I want to match folder1/, folder2/, folder3/ and folder3a/ but not files/

Any ideas?

Best Answer

what you're doing here is inverting hierarchy. Everything is designed to work the other way around. My advice would be to change your folder structure so that you don't need to do things backwards.

Perhaps have one folder for your scripts, and enable PHP in that only, and another folder containing everything else.