I am using debian 11 but How can i Force download instead of streaming WordPress because i added this to below to htaccess and my site will show internal server error
<FilesMatch “.(mov|mp3|jpg|pdf)$”>
ForceType application/octet-stream
Header set Content-Disposition attachment
Of course. You can find the answer here in this link.
In the link can see that you can try this things:
If you have apache2 with mod_header you can do something like this:
<FilesMatch "\.jpg$">
Header add "Content-Disposition" "attachment"
</FilesMatch>
Other ways you have to make simple PHP script which uses header() function to do the job and then simple pass target file to output.
<?php
$allowed_path = __DIR__."/downloads/";
$file = $allowed_path.basename($_GET["file"]);
if(file_exists($file)) {
header("Content-disposition: attachment");
readfile($file);
}
else {
header('HTTP/1.1 404 Not Found', TRUE, 404);
}