Apache force file download






















Learn more. How to configure Apache2 to download files directly? Ask Question. Asked 6 years, 7 months ago. Active 6 years, 7 months ago. Viewed 29k times. In the file, I had this string: This is a test file. Improve this question. Lightn1ng Lightn1ng 1 1 gold badge 2 2 silver badges 5 5 bronze badges.

Add a comment. Active Oldest Votes. Improve this answer. Community Bot 1. Kresimir Pendic Kresimir Pendic 1, 9 9 silver badges 12 12 bronze badges.

It applies ForceType directive to all matching requests, which forces download in Apache server. We also set its Content-Disposition header to be attachment for this purpose. If you want to force download for multiple files types such as.

Please note, if you place the above code in. If you place it in. Add a comment. Active Oldest Votes. Yes create an. EDIT: Without an. Bismarck Bismarck 1 1 silver badge 8 8 bronze badges. In your php solution, you'd be better to swap your conditional if! It's as simple as adding an alias directive within your apache config. Progrock Progrock 6, 1 1 gold badge 16 16 silver badges 25 25 bronze badges. Chris Hawkes Chris Hawkes Sign up or log in Sign up using Google.

Connect and share knowledge within a single location that is structured and easy to search. I already know that the 2 lines inside the tag works, because it works when I put a. Please look at the documentation for FilesMatch and Files , respectively. It clearly states. The directives given within this section will be applied to any object with a basename last component of filename matching the specified filename. That means that in your example it matches against file.

It actually can never match, since it contains a slash, which is used as a directory separator. Unfortunately, the Location directive is not allowed inside. Just create a. Stack Overflow for Teams — Collaborate and share knowledge with a private group. Create a free Team What is Teams? Collectives on Stack Overflow. Learn more. Asked 8 years, 10 months ago.



0コメント

  • 1000 / 1000