dr0zd
dr0zd

Reputation: 1378

Apache download files with specific extension

I have download directory on apache webserver. Files in this directory have specific extensions. For example *.yyy and *.zzz. But all these files are renamed .zip or .tar.gz

I've tested in different brawsers and havn't got any problems.

But some users tell that they get source of packages, not download.

I've created.htaccess

AddType application/zip .zzz
AddType application/x-gzip .yyy

But when I try to download aaa.yyy in MS Internet Explorer it try to save not aaa.yyy but aaa.gz

How to force browsers download files and not to change extensions?

Upvotes: 3

Views: 6263

Answers (1)

Soroush Falahati
Soroush Falahati

Reputation: 2327

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

Force type tell browsers that you dont know file type. So they are not going to do any thing stupid. Second line will tell them to download this file.

Upvotes: 6

Related Questions