Site icon SumTips

Force Download Files on your Website using htaccess

If you want to make your website visitors download a file rather than viewing in their browser, add the code below to the htaccess file.

AddType application/octet-stream .pdf
AddType application/octet-stream .mp3
AddType application/octet-stream .mov
AddType application/octet-stream .avi
AddType application/octet-stream .mpg
AddType application/octet-stream .jpg
AddType application/octet-stream .csv
AddType application/octet-stream .xls
AddType application/octet-stream .doc

Note: Each file-type should be specified in a separate line.

Now whenever a user clicks on a link pointing to any of those file types, they will be automatically prompted to download the file.

Exit mobile version