Gzipping .ttf files

I cannot gzipped these .ttf files because of the extension appended to them: ?vjfhgj and ?tppylb

/wp-content/themes/name/scss/icon-fonts/fonts/ui-icomoon.ttf?vjfhgj

/wp-content/themes/name/fonts/icon-fonts/icomoon/fonts/bb-icomoon.ttf?tppylb

I get a warning in webpagetest.org for potential savings if apply gzip compression to them. All files have being compressed except those two.

.htaccess

    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

I cleared custom cache for individual files and purged everything, nothing fixed it. ¿Any idea how to solve it?

The normal mime type for ttf files is:
AddType font/ttf .ttf

Change that line in your .htaccess and the issue should be resolved, as cloudflare will automatically compress the files.

Do you know where the query parameter is coming from? Are they always the same?

2 Likes

I added it to .htaccess, but issue persists, yes those two query parameters are always the same, I dont know their origin.

<IfModule mod_mime.c>
 AddType font/ttf .ttf
</IfModule>

Is this line still in your .htaccess?

Can you share a URL for the font?

This one is:

<IfModule mod_mime.c>
AddType image/webp .webp
AddType font/ttf .ttf
</IfModule>

Urls for the fonts:
wp-content/themes/boombox/fonts/icon-fonts/icomoon/fonts/bb-icomoon.ttf?tppylb
wp-content/themes/boombox/scss/icon-fonts/fonts/ui-icomoon.ttf?vjfhgj

I see, does CF supports those types?

Yes, obviously.

I placed these types in .htaccess of public-html and wp-content

<IfModule mod_mime.c>
    AddType image/webp .webp
    AddType application/vnd.ms-fontobject .eot
    AddType application/x-font-truetype .ttf
    AddType application/font-woff .woff
    AddType application/x-font-opentype .otf
    AddType application/octet-stream .otf .ttf 
</IfModule>

with no success yet, I would apreciate your help

This type of configuration on your Apache server is outside the scope of this forum. Probably best to head over to StackOverflow.

1 Like

This topic was automatically closed after 14 days. New replies are no longer allowed.