peter.v.nagy
posted this
17 hours ago
I think it is somewhat easier to set the content disposition header of your web page. If your web page is hosted on an Apache web server, you can do it in a simple way. Let's say you would like any PDF file to be automatically downloaded from the web site instead of being displayed. Then, you have to create a file named '.htaccess', and write the following lines to the file:
<FilesMatch ".(pdf)$">
Header set Content-Disposition attachment
If you want more than one file type to be downloaded, then write this:
<FilesMatch ".(pdf|docx|zip)$">
Header set Content-Disposition attachment
If you want just a certain file to be downloaded, add the following lines to the .htaccess file:
<Files "example.pdf">
Header set Content-Disposition attachment
And upload the .htaccess file to the root directory, commonly the public_html folder, or any folder whose properties you want to modify.
Peter
I think it is somewhat easier to set the content disposition header of your web page. If your web page is hosted on an Apache web server, you can do it in a simple way. Let's say you would like any PDF file to be automatically downloaded from the web site instead of being displayed. Then, you have to create a file named '.htaccess', and write the following lines to the file:
<FilesMatch "\.(pdf)$">
Header set Content-Disposition attachment
If you want more than one file type to be downloaded, then write this:
<FilesMatch "\.(pdf|docx|zip)$">
Header set Content-Disposition attachment
If you want just a certain file to be downloaded, add the following lines to the .htaccess file:
<Files "example.pdf">
Header set Content-Disposition attachment
And upload the .htaccess file to the root directory, commonly the public_html folder, or any folder whose properties you want to modify.
Peter