Danylo Mysak
Danylo Mysak

Reputation: 1512

Sending header according to MIME type of the file

Is it possible to configure .htaccess file in a way that some specific header will be sent only with files of the given MIME type? More specifically, I want to send Content-Disposition: attachment header for text/html files leaving other file types unaffected. Names and even extensions of such files are not known a priori since the files are user uploaded.

Upvotes: 0

Views: 361

Answers (1)

user2286243
user2286243

Reputation:

After a lot of search, I am unable to find a solution for sending unique headers based on MIME type. But, the closest thing I found is to to send special header based on their file type.

To send a special header for .etc extension file use:

<FilesMatch "\.(?i:etc)$">
     Header set Content-Disposition: attachment
</FilesMatch>

Upvotes: 1

Related Questions