Forum Moderators: phranque
I'm not sure though; the thread title suggests you want to match a directory and your post mentions a file. If it's a file, then this is the way (just a filename):
<Files file.html>
....
</Files> If it's a file in a specific subdir, you apparently have to make it a regexp or use FilesMatch (preferred) in stead:
<Files ~ "path/to/file.html">
....
</Files> or:
<FilesMatch "path/to/file.html">
....
</FilesMatch> No tilde "~" needed in the last one, as it uses regexps by default. Hope one of these will do the trick.
/claus
This might do it though:
<Files file>
ForceType application/x-httpd-php
</Files> Just the file name, but this will match that filename in all directories. Or:
<FilesMatch path/to>
ForceType application/x-httpd-php
</FilesMatch> Just the directory name, perhaps even like this (added "/" and ".*" although the last should not be necessary):
<FilesMatch /path/to.*> Here's an article i just found that suggests the first way to do it:
[devarticles.com...]
/claus
The asterisk makes sure that all files everywhere ("any sequence of characters") are matched and treated as php, that's why it works (or perhaps not, your gifs also becomes php that way). This makes me think that the problem is that the right file is not matched, so it's a regexp issue. This might do it:
<FilesMatch "^/path/to/filename$"> included ^ to mark start of path and $ to mark the end. Enclosed it all in double quotes, these might not be needed after all.
[edited by: claus at 10:10 am (utc) on Sep. 3, 2003]
"The name of a file with no accompanying path information as in file.html."
So the regexps will send Apache looking for the path to match within the filename, and as the path is preceding the filename it is not part of it.
So, either you use that rule on all files everywhere with the same name or you use a separate htaccess file in the directory with the right file in it.
/claus