How to make Apache force download of files (in .htaccess)

October 26, 2018

If you want to force the download of files (octet-stream), you can use this code. Edit the file types as required.

AddType application/octet-stream .doc .docx .xls .pdf

You can use this to force PDFs to download and not show in the browser:

AddType application/octet-stream .pdf

If you want to force other file types (such as Word Document, Excel, etc) just edit the file type