.htaccess - Activate save-as or open pop-up box for video files -
in .htaccess did manage activate pop-up box save-as , open options file download, files being images, jpg, jpeg, png etc. works perfectly.
here code:
<ifmodule mod_headers.c> <filesmatch "\.jpg$"> header append content-disposition "attachment;" </filesmatch> <filesmatch "\.jpeg$"> header append content-disposition "attachment;" </filesmatch> <filesmatch "\.png$"> header append content-disposition "attachment;" </filesmatch> <filesmatch "\.ogv$"> header append content-disposition "attachment;" </filesmatch> <filesmatch "\.mov$"> header append content-disposition "attachment;" </filesmatch> <filesmatch "\.avi$"> header append content-disposition "attachment;" </filesmatch> <filesmatch "\.mp4$"> header append content-disposition "attachment;" </filesmatch> </ifmodule>
now want have same feature video files (ogv, avi, mp4, etc.), , added code same way, not work video files, how make solution work?
you can use addtype
force downloads:
addtype application/octet-stream .ogv addtype application/octet-stream .avi addtype application/octet-stream .mp4
alternatively, can use method, , incorporate other file types you've alrady done:
<filesmatch "\.(jpe?g|png|ogv|mov|avi|mp4)$" > forcetype application/octet-stream header add content-disposition "attachment" </filesmatch>
this option can try:
rewritecond %{request_filename} -f rewriterule \.(jpe?g|png|ogv|mov|avi|mp4)$ - [t=application/octet-stream]
regarding firefox: appears ff requires filename set. best way can think of doing - , appears work perfectly:
rewriteengine on rewritecond %{request_filename} -f rewriterule ^(.+).(jpe?g|png|ogv|mov|avi|mp4)$ - [env=filename:$1.$2] <filesmatch "\.(jpe?g|png|ogv|mov|avi|mp4)$" > forcetype application/octet-stream header add content-disposition "attachment; filename=%{filename}e" </filesmatch>
here, we're checking see if request existing file, , if file ends extension. if so, set environment variable called filename
, , pass header add
. quite magical, really. firefox quite strict few other things - know.
Comments
Post a Comment