Enable CORS in WordPress environment

I have a site based on WordPress where I use WPML for translation. domain1 is my base domain – and then I point my domain2 DNS to domain1 where its parked. In WPML I set it to listen to domain2 for my second language.

Problem? It wont load my custom fonts for the second domain.

Read More

Error: Font from origin ‘http://domain1‘ has been blocked from loading
by Cross-Origin Resource Sharing policy: No
‘Access-Control-Allow-Origin’ header is present on the requested
resource. Origin ‘http://domain2‘ is therefore not allowed access.

I have tried to enable CORS via my .htaccess with:

header("Access-Control-Allow-Origin: * 

And I tried to add it via php with:

<?php /** @package WordPress @subpackage Default_Theme  **/
header("Access-Control-Allow-Origin: *"); 
?>

Nothing seems to work. What am I doing wrong?

Related posts