Forum Moderators: phranque
If one of these directives are in .htaccess...
<Files test>
ForceType application/x-httpd-cgi
</Files>
..OR..
<FilesMatch "test">
ForceType application/x-httpd-cgi
</FilesMatch>
Then this seems to affect example.com/test AND example.com/dir/test
Whereas I'm looking to apply it to ONLY one specific file, excluding subdirectories. What did I miss?
You could put additional .htaccess files in the subdirectories, using RemoveType to override the 'global' file setting in higher-level .htaccess files. A better approach would be to use a consistent filename-handling plan.
Remember that filenames and URL-paths need not resemble each other; You can use mod_rewrite to 'map' any URL to any filepath/filename/filetype. Therefore, having separate URL-based directives and filename-based directives is quite useful.
For example, if you use extensionless URLs, then filename-based directives are required to enable you to set MIME-types based on the filetype, not the URL. Since the URLs have no "file extensions," this would be impossible without filename-based directives.
See Apache mod_mime for more info on RemoveType
Jim