views:

14

answers:

2

I've got this this rule in my htaccess file to force linked files to download rather than open in the browser:

<FilesMatch "\.(gif|jpe?g|png)$">
  ForceType application/octet-stream
  Header set Content-Disposition attachment
</FilesMatch>

Is there a way to alter the RegExp so it only applies to files in a certain directory?\

Thanks

A: 

Put it in a <Location> directive, and/or modify the regex to exclude slashes or as appropriate.

Ignacio Vazquez-Abrams
Location doesn't seems to work in htaccess files, is there an alternative way?
Oliver
+1  A: 

You will probably need to put the directives in the .htaccess file in the particular directory.

Gumbo
A ha! Yes! This must be the solution, damn my inflexible mind!
Oliver