Forum Moderators: phranque
I am using the AddHandler directive in a .htaccess file to tell PHP to parse .html files in the current directory. However, I don't want any files in any subdirectories to be parsed; only the current directory.
I would assume that <Directory> or <DirectoryMatch> can do the trick, but how to use the right regex to only parse the current directory is the problem.
Looks something like this:
<DirectoryMatch "regex for current directory only goes here">
AddHandler x-httpd-php5 .html
</DirectoryMatch>
Any advise on how to get this to work?
PS: Can <Directory> or <DirectoryMatch> be used in an .htaccess file? If not, how to get it to work?
Thanks.
--
Ed
In .htaccess, you're limited to using <Files> or <FilesMatch>, neither of which care about the directory path, and only see the filename. So they're of little use.
I'd suggest you look into using XBitHack instead (see Apache mod_includes). Or you could rename the files to .php, and then use mod_rewrite to re-connect the existing .html URLs to the newly-renamed files using an internal rewrite.
Jim