APACHE 2 - Force download requested files
The goal of this change is to add the following line of code into the headers section of your config file:
This change will force download the requested file.
1) Enable mod_headers module (it is usually disabled by default). In Debian and Ubuntu Linux distributions use the following command:
For Linux distributions or other Unix systems without additional module handling infrastructure add the following line to web servers httpd.conf :
2) Now, we need to tell the web server to send specific headers for those specific situations.
Open your virtual server configuration:
For example: to make all pdf and jpg files to be downloaded instead of open in browser add the following code to your configuration:
Make sure that you don't have any duplicate headers before we proceed to the last step.
3) Restart your web server for changes to take effect with the following command: