Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
How to get web fonts working correctly in your server environment.

If you have web fonts on a subdomain seperate to the domain you are calling them, usual advice is to place the following into the .htaccess file for the subdomain

<IfModule mod_headers.c>
  <FilesMatch “.(eot|otf|ttc|ttf|woff|woff2)$”>
    Header set Access-Control-Allow-Origin “*”

If that doesn’t work, it’s likely the header module in apache isn’t enabled. Find out by creating a .htaccess file with just this line.

Header set Access-Control-Allow-Origin “*”

Try to view a web page. If you get errors, most likely the header module isn’t enabled in apache. Enable it from the command line like this

sudo a2enmod headers

then restart apache.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.