htaccess设置单个文件的模仿类型 [英] htaccess setting the mimetype for a single file
本文介绍了htaccess设置单个文件的模仿类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在.htaccess文件中,可以为给定扩展名设置模仿类型,例如:
In an .htaccess file one might set the mimetype for a given extension like:
AddType application/javascript .js
如何为单个文件而不是扩展名设置模仿类型?我有一个Javascript与同一个文件夹中的其他Javascript文件需要不同的模仿类型。
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
第二行不起作用。
推荐答案
您可以使用< files>
容器来匹配文件名,然后再添加
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>
这篇关于htaccess设置单个文件的模仿类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文