apache - htaccess设置单个文件的模仿类型

标签 apache .htaccess

在.htaccess文件中,可以为给定扩展名设置模仿类型,例如:

AddType application/javascript .js

一个人如何为单个文件而不是扩展名设置模仿类型?我在同一个文件夹中有一个Javascript与其他Javascript文件需要不同的模仿类型。
AddType application/javascript .js
AddType application/ecmascript specialfile.js

第二行不起作用。

最佳答案

您可以使用<files>容器来匹配文件的名称,然后再为其添加类型:

<Files specialfile.js>
    AddType application/ecmascript .js
</Files>

关于apache - htaccess设置单个文件的模仿类型,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15628826/

相关文章:

.htaccess - 无法将 https ://www. example.com 映射到 https ://example. com

apache - 如何从 nextcloud docker 容器获取更详细的日志

apache - 重定向和查询字符串的问题

.htaccess - 自适应图像 CakePHP htaccess

linux - 代理或重写规则以通过代理服务器中的云端提供静态内容

php - 如何为 PHP 文件启用 mod_deflate?

regex - 使用 .htaccess 文件删除 .php 文件扩展名

java - 如何从apache poi读取word文档中的注释?

javascript - 单击按钮时如何让用户下载多个文件?

apache - http 到 https 导致重定向循环