Support the ongoing development of Laravel.io →
Configuration

Hello, i am using Apache as backend server and nginx as frontend server. I need to make PDF files downloadable (at this moment they are opening in a browser window).

Here's what i have in my .htaccess file:

<FilesMatch "\.(pdf)$">
   ForceType application/octet-stream
   Header set Content-Disposition attachment
</FilesMatch>

but still when i press on the link with PDF file it just opens PDF not downloading.

Last updated 3 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.