Support

Admin Tools

#25959 Improve Expire also for Font files

Posted in ‘Admin Tools for Joomla! 4 & 5’
This is a public ticket

Everybody will be able to see its contents. Do not include usernames, passwords or any other sensitive information.

Environment Information

Joomla! version
n/a
PHP version
n/a
Admin Tools version
n/a

Latest post by user87102 on Wednesday, 24 August 2016 08:10 CDT

user87102
 Google have a great tool to check optimization ( https://developers.google.com/speed/pagespeed/insights/ ), this tool make a warning about expiration time of fonts (i.e. .woff files), now these type of files inherit default expire time (1 hour).

The solution is to add this code in .htaccess when expire setting is enabled:

AddType application/vnd.ms-fontobject .eot
AddType application/x-font-ttf .ttf
AddType application/x-font-opentype .otf
AddType application/x-font-woff .woff
AddType image/svg+xml .svg
ExpiresByType application/vnd.ms-fontobject "now plus 1 week"
ExpiresByType application/x-font-ttf "now plus 1 week"
ExpiresByType application/x-font-opentype "now plus 1 week"
ExpiresByType application/x-font-woff "now plus 1 week"
ExpiresByType image/svg+xml "now plus 1 week"

This for me works perfectly, but I'm not a expert about htacces, so I don't know if this can cause some compatibility issues.

My request is to add this code is next release (of course if this not cause problems)

Regards
Fiorino

nicholas
Akeeba Staff
Manager
Good point! Will do. Just a few notes on implementation and best practices:

1. Only the ExpiresByType lines will be added in the next release. The AddType lines are not necessary on up to date servers (Apache already includes these in its mime.types file). Moreover, these lines can cause problems on unnecessarily locked down servers – you'd be surprised at the crazy things misguided server admins do...

2. It is strongly recommended not to host the fonts your own server. It slows down the page load speed and creates ugly artefacts when your site is loaded over slow or high latency connections (if you are ever throttled to 2G data by your carrier you'll know what I mean). The best approach is to use Google Fonts. Everybody is using them so it's very likely they are already loaded in the cache of your visitor's browser.

Nicholas K. Dionysopoulos

Lead Developer and Director

🇬🇷Greek: native 🇬🇧English: excellent 🇫🇷French: basic • 🕐 My time zone is Europe / Athens
Please keep in mind my timezone and cultural differences when reading my replies. Thank you!

user87102
Hi Nicholas,
thanks for understanding and quick reply.

small notes about your explanation:
1. Great, I have copied the code from stackoverflow.com :D
2. Yes you have right, but many components/templates uses own local version of fonts for vector icons.

great support. Regards
Fiorino

Support Information

Working hours: We are open Monday to Friday, 9am to 7pm Cyprus timezone (EET / EEST). Support is provided by the same developers writing the software, all of which live in Europe. You can still file tickets outside of our working hours, but we cannot respond to them until we're back at the office.

Support policy: We would like to kindly inform you that when using our support you have already agreed to the Support Policy which is part of our Terms of Service. Thank you for your understanding and for helping us help you!