lundi 5 octobre 2015

Enable CORS - how to do this right

So. 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.

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 .htacces 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?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire