[Resolved] Fonts don't work from a cookie-free domain?
Hi, do you know if it works to serve the web fonts from a “cookie free domain”?
I just tried to impliment a feature in WordPress Core which lets you set the domain which cookies are served from, and thus also set a cookie-free domain for the static content, which should help with page performance. It’s recommended by the “YSlow” speed test, as well as by numerous WordPress tutorials like this one (Tip #1) and by Google themselves.
So I registered a new sub-domain for myself (static.example.com – I’ll use “example.com” as my domain name here). Then I added these two lines to my wp-config.php file as instructed in the tutorials:
define('WP_CONTENT_URL', 'http://static.example.com'); define('COOKIE_DOMAIN', 'www.example.com');
Everything works perfectly fine on my website after this, with the sole exception of the Font Awesome fonts from this plugin – they don’t display at all!
The path to the CSS file, which now appears in the <head> section of my pages, is correct and works:
In trying to troubleshoot this, the first thing I did was open the wpvi-fa4.css file and change the font paths there, from:
But that didn’t work.
Then I changed the font paths in the wpvi-fa4.css file to:
And then the fonts worked again! They were now displaying correctly on my website.
So for some reason it seems the fonts don’t work when they are using the “static” URL, even though the URL itself is correct.
But I have no idea why this would be so.
I could change the URL of the CSS file to point to the BootstrapCDN path at //netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css and this would work fine – and I believe this CDN server would also be cookie-free – so I don’t know why it fails when I use static.example.com instead.
Any ideas or thoughts?
- The topic ‘[Resolved] Fonts don't work from a cookie-free domain?’ is closed to new replies.