The Problem: A link to a QuickTime file normally results in the Quicktime plugin opening the file within the browser, which is unhelpful for the user who wants to download the file.
The Solution: While a right-click ‚”Save As” is intuitive for the technical user, it makes life difficult for some.The easy solution is to send a Content-Disposition header using an .htaccess file:
<FilesMatch> Header set Content-Disposition attachment </FilesMatch>
This is fine, except it will always try to force the user to download the file, which might not be desirable. The solution to this is to use mod_rewrite and environmental variables to conditionally force the download:
In ./download/.htaccess
RewriteEngine On RewriteRule (.*) ../$1 [L,NC,QSA,E=force_download:1]
In ./.htaccess
<filesmatch> Header set Content-Disposition attachment env=REDIRECT_force_download </filesmatch>
Now, when a user browses to http://example.org/movie.mp4, the QuickTime plugin will perform its default action, and when the user goes to http://example.org/download/movie.mp4, they will be prompted to download the file.