CodeMouse92
CodeMouse92

Reputation: 6898

Webfont not appearing without www

This may be one of those bright-blazingly obvious answers, but I cannot dig up the answer, despite plenty of Google milage.

I have a website that uses a webfont. It all works swimmingly most of the time. I also am using .htaccess to redirect things like /company to /company.html quietly.

Here's my issue...the webfont only works when you include the www. in the url. If you omit it, the webfont doesn't load.

I have a feeling that the problem is stemming from the fact that I have to use an absolute path on my webfont, and that absolute font uses www. If I omit the www, then the reverse problem exists. I can't use relative because the .htaccess buggers that (obviously).

The website is here. Add and remove the www. to see what I mean.

So, what am I missing?

NOTE IN ADVANCE: If anyone suggests automatically redirecting to either all www or non-www URLs, great, I can't seem to figure out the .htaccess codes for that. I would need to redirect to only use www, as that's what all my links are using, and I don't feel like changing them all around, argh.

But if you have an alternative method to fix this, that's appreciated too.

Upvotes: 1

Views: 100

Answers (1)

user3912920
user3912920

Reputation:

It seems that you have a problem with your Cross-Origin Resource Sharing Policy.

Try to add this to your .htaccess file:

<FilesMatch "\.(ttf|otf|eot|woff)$">
  <IfModule mod_headers.c>
    Header set Access-Control-Allow-Origin "*"
 </IfModule>
</FilesMatch>

You can find more information in this answer on question How to add an Access-Control-Allow-Origin header.

Upvotes: 3

Related Questions