Control Web Panel
WebPanel => Apache => Topic started by: Starburst on December 18, 2024, 04:03:07 PM
-
Anyone know how to stop Apache from opening a text file that has no extension.
e.g. TIME, PublicKey, etc. - Basically anything without an extension.
Ref. https://mariadb.gb.ssimn.org/ (https://mariadb.gb.ssimn.org/)
Need those files to download, instead of open.
-
IF you make a simple HTML page with the following code it will be downloaded as a file:
<a href="somepathto.pdf" download="filename">
If you have Apache add this to the .htaccess file:
<FilesMatch "\.(?i:pdf)$">
ForceType application/octet-stream
Header set Content-Disposition attachment
</FilesMatch>
-
Thanks for the suggestions, got it working with a .htaccess
Where I was trying was under <Directory> I was trying to figure out how to put it there.
Currently:
AddType application/octet-stream .iso
AddType application/octet-stream .rpm
Tried adding:
ForceType application/octet-stream TIME
But didn't work.
-
I think you're on the right track, but maybe set it more broadly?
DefaultType application/octet-stream
Or did you try the Content-Disposition header?
<filesMatch "^([^.]+)$">
Header set Content-Disposition "attachment"
</filesMatch>