I made a simple site on let's say main_domain.com. Therefore I have landing_page CCT details page available on main_domain.com/landing_pages/my-landing.

My goal is to hook one domain per landing_page CCT, i.e

  • domain1.com will serve main_domain.com/landing_pages/my-landing
  • domain2.com will serve main_domain.com/landing_pages/my-landing-2
  • ...

I added following lines in my .htaccess, making things work :

RewriteCond %{HTTP_HOST} ^domain1\.com$ [NC]
RewriteRule ^(.*)$ index.php?landing_page=my-landing [NC,QSA]

Should I say that I added domain1.com as ServerAlias on vhost. My problem now lies with CORS regarding fonts : landing_page page loads correctly except for embedded fonts for which I got error :

(index):1 Access to Font at 'http://main_domain.com/wp-content/themes/my_theme/dist/fonts/FuturaStd-Bold.otf' from origin 'http://domain1.com' has been blocked by CORS policy: The 'Access-Control-Allow-Origin' header contains the invalid value 'main_domain.com'. Origin 'http://domain1.com' is therefore not allowed access.

I tried to

  • Force Header set Access-Control-Allow-Origin "*" in .htaccess, but it fails sometimes with error that Access-Control-Allow-Origin is set multiple times.

  • Add allowed origin using filter allowed_http_origins

     add_filter( 'allowed_http_origins', 'mytheme_add_origins' );
     function mytheme_add_origins($origin) {
        $origin[] = 'domain1.com';
        return $origin;

    None of this worked. How can I make it work?

Stuck on this for a while, thanks !

  • When you got the message, the header was being sent twice? – jrtapsell Jun 4 '18 at 0:14
  • Yes I saw it defined twice in response headers. – nbonniot Jun 4 '18 at 15:26
  • When you tried the second one, what headers were sent? – jrtapsell Jun 4 '18 at 15:32
  • First Access-Control-Allow-Origin:domain1.com, second Access-Control-Allow-Origin "*" – nbonniot Jun 4 '18 at 17:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.