Skip to content

Instantly share code, notes, and snippets.

@localpcguy
Last active July 29, 2021 13:37
Show Gist options
  • Star 8 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save localpcguy/6002288 to your computer and use it in GitHub Desktop.
Save localpcguy/6002288 to your computer and use it in GitHub Desktop.
Mime Types for Fonts and Media
.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=".svg" 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
@GeekyMonkey
Copy link

in font-mimetypes on line 15 it seems like the "woff" should be "svg"

@xgqfrms
Copy link

xgqfrms commented Jul 29, 2021

https://stackoverflow.com/questions/2871655/proper-mime-type-for-otf-fonts

svg   as "image/svg+xml"                  (W3C: August 2011)
ttf   as "application/x-font-ttf"         (IANA: March 2013)
      or "application/x-font-truetype"
otf   as "application/x-font-opentype"    (IANA: March 2013)
woff  as "application/font-woff"          (IANA: January 2013)
woff2 as "application/font-woff2"         (W3C W./E.Draft: May 2014/March 2016)
eot   as "application/vnd.ms-fontobject"  (IANA: December 2005)
sfnt  as "application/font-sfnt"          (IANA: March 2013) 

@localpcguy
Copy link
Author

Thanks for the correction and updates 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment