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

编程入门 行业动态 更新时间:2024-10-20 07:42:00
本文介绍了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设置单个文件的模仿类型

本文发布于:2023-11-01 18:13:03,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1550049.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:类型   文件   htaccess

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!