August 23, 201313 yr So, I have always used a php file for my download links - sent them to a file that forced a download by setting the content-disposition to attachment and the content-type to application/octet-stream. However most recently I stumbled onto a post about doing it in the .htaccess file by simply adding: AddType application/octet-stream .mp3 Now, I know absolutely nothing about htacces, but this seems fairly simple to me. That obviously forces the content-type for all mp3 files to octet-stream. Which got me wondering (because I know forcing the content-type isn't enough, some browsers still open it in the browser), is there a way of using htaccess to also set the content-disposition. After a bit of googling around, I didn't find anything that was as simple as that, but have found this: <FilesMatch "\.(?i:mp3)$"> ForceType application/octet-stream Header set Content-Disposition attachment </FilesMatch> Which is working a treat on the wordpress site I've just set up - BUT, I just wanted to stop by and ask, is this the best way of doing it? Thanks, JD.
Create an account or sign in to comment