Like @gumbo said, put the .htaccess
file in the highest level folder you want to affect. and those settings will trickle down to sub folders. You may also want to make sure the headers
module is enabled before using this in your htaccess
file. The following line will generate an error if the headers module is not enabled:
Header set Content-Disposition attachment
here's an example that forces download of mp3 files only if the headers module is enabled:
<IfModule mod_headers.c>
<FilesMatch "\.(mp3|MP3)$">
ForceType audio/mpeg
Header set Content-Disposition "attachment"
Allow from all
</FilesMatch>
</IfModule>
Note: it does not enable the module, it just ignores anything inside the IfModule tags if the module is not enabled.
To enable apache modules you'll either need to edit your httpd.conf file or in wamp server you can click the wamp tray icon and select "Apache -> Apache Modules -> headers_module" or make sure it is checked.
application/octet-stream
? This is simply telling the browser you don't know what the filetype is. And that's not true. To force a download,Content-Disposition: attachment
is all you need.