Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Correct Apache AddType directives for font MIME types

I’m using @font-face for embedded fonts (thanks Paul Irish). In trying to fix Chrome’s warning about wrong MIME type for woff fonts, I’ve discovered a mass of conflicting suggestions.

Everyone seems to agree that .eot fonts (for IE 6-8?) should be served using

AddType application/vnd.ms-fontobject .eot 

For .ttf fonts (older non-IE browsers?) I’ve seen

AddType application/x-font-ttf        .ttf AddType application/octet-stream      .ttf AddType font/truetype                 .ttf AddType font/ttf                      .ttf 

And for .woff fonts (the new standard?) I’ve seen

AddType application/font-wof          .woff AddType application/x-font-woff       .woff AddType application/x-woff            .woff 

I understand the correct MIME type for woff will be application/font-woff, but until the standard is official, application/x-font-woff is understood by Chrome.

I realise I’ve half answered my question in asking it, but the question is really: is there any authoritative guidance or further advice about what MIME types should be used for fonts?

Update (in case it’s of any help to anyone else): since there seems to be nothing authoritative, I’ve settled on using the following font MIME types in my .htaccess (which at least keeps Chrome happy):

AddType application/vnd.ms-fontobject .eot AddType application/x-font-ttf        .ttf AddType application/x-font-woff       .woff 
like image 573
ChrisV Avatar asked Sep 14 '11 11:09

ChrisV


People also ask

What is Apache mime?

MIME stands for Multimedia Internet Mail Extensions. The code used here is in mod_mime. c and is compiled in by default. It allows Apache to determine the type of a file from its extension. The list of MIME types that Apache already knows about is distributed in the file ..

What is apache AddType?

The AddType directive maps the given filename extensions onto the specified content type. media-type is the media type to use for filenames containing extension .

What is mime_ module?

Syntax summary: mime_module TypesConfig file. This command specifies the name of the file that does the lookup from filename suffix to MIME content type. On a SLES system this file is /etc/mime. types and is installed by the aaa-base package.


1 Answers

I realize that this question is old, but for anyone looking for a quick copy/paste for adding font MIME types to their .htaccess:

<IfModule mod_mime.c>     AddType application/vnd.ms-fontobject    .eot     AddType application/x-font-opentype      .otf     AddType image/svg+xml                    .svg     AddType application/x-font-ttf           .ttf     AddType application/font-woff            .woff     AddType application/font-woff2           .woff2 </IfModule> 
like image 139
Chris Clower Avatar answered Sep 30 '22 12:09

Chris Clower