Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

htaccess setting the mimetype for a single file

In an .htaccess file one might set the mimetype for a given extension like:

AddType application/javascript .js

How would one set the mimetype for a single file instead of an extension? I have one Javascript that needs a different mimetype than other Javascript files in the same folder.

AddType application/javascript .js
AddType application/ecmascript specialfile.js

The second line does not work.

like image 851
eeejay Avatar asked Mar 26 '13 03:03

eeejay


1 Answers

You can use the <files> container to match the file's name before adding a type for it:

<Files specialfile.js>
    AddType application/ecmascript .js
</Files>
like image 77
Mike Rockétt Avatar answered Nov 19 '22 18:11

Mike Rockétt