Skip to content

Instantly share code, notes, and snippets.

@wpsmith
Forked from localpcguy/font-mimetypes
Last active April 25, 2024 00:44
Show Gist options
  • Save wpsmith/478e133b4f96a93e17bc to your computer and use it in GitHub Desktop.
Save wpsmith/478e133b4f96a93e17bc to your computer and use it in GitHub Desktop.
Mime Types for .htaccess or web.config
.eot - application/vnd.ms-fontobject
.woff - application/font-woff
.ttf - application/x-font-truetype
.svg - image/svg+xml
.otf - application/x-font-opentype
IIS (Web.Config)
<remove fileExtension=".eot" />
<mimeMap fileExtension=".eot" mimeType="application/vnd.ms-fontobject" />
<remove fileExtension=".ttf" />
<mimeMap fileExtension=".ttf" mimeType="application/x-font-truetype" />
<remove fileExtension=".woff" />
<mimeMap fileExtension=".woff" mimeType="application/font-woff" />
<remove fileExtension=".svg" />
<mimeMap fileExtension=".woff" mimeType="image/svg+xml" />
<mimeMap fileExtension=".otf" mimeType="application/x-font-opentype" />
Apache (.htaccess)
AddType application/vnd.ms-fontobject .eot
AddType application/x-font-truetype .ttf
AddType application/font-woff .woff
AddType application/x-font-opentype .otf
# could use application/octet-stream for default binary file transfer
#AddType application/octet-stream .otf .ttf
.mp4 - video/mp4
.ogv - video/ogg
.m4v - video/mp4
.webm - video/webm
Web.Config (IIS)
<remove fileExtension=".mp4" />
<mimeMap fileExtension=".mp4" mimeType="video/mp4" />
<remove fileExtension=".ogv" />
<mimeMap fileExtension=".ogv" mimeType="video/ogg" />
<remove fileExtension=".m4v" />
<mimeMap fileExtension=".m4v" mimeType="video/mp4" />
<remove fileExtension=".webm" />
<mimeMap fileExtension=".webm" mimeType="video/webm" />
Apache
AddType video/mp4 .mp4 .m4v
AddType video/ogg .ogv
AddType video/webm .webm
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<staticContent>
<remove fileExtension=".svg"/>
<mimeMap fileExtension=".svg" mimeType="image/svg+xml"/>
<remove fileExtension=".woff" />
<mimeMap fileExtension=".woff" mimeType="application/x-font-woff" />
<remove fileExtension=".ttf" />
<mimeMap fileExtension=".ttf" mimeType="application/octet-stream" />
<remove fileExtension=".eot" />
<mimeMap fileExtension=".eot" mimeType="application/vnd.ms-fontobject" />
<remove fileExtension=".otf" />
<mimeMap fileExtension=".otf" mimeType="font/otf" />
</staticContent>
</system.webServer>
</configuration>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment