Home ›
Using mod_header to force file downloadsUsing mod_header to force file downloads
Submitted by Stefan Freudenberg on September 15, 2009 - 2:01pm
The file_force module offers a solution to the problem of offering download links to nimages and other file types that are otherwise displayed in a browser. As the maintainer of the module states it is not the best solution as it redirects access to static content through a php script. He suggests using a webserver based solution; here is one using Apache's mod_header setting the Content-Disposition header in a given context:
<IfModule mod_headers.c>
<Location ~ ".*/downloads/.*">
Header set Content-Disposition attachment
</Location>
</IfModule>