0

I am having a problem with serving static theme assets and plugins assets from the correct domain on our multisite sage website. We have 2 different domains for the multisite. The first domain is maindomain and the second is let’s say otherdomain

So everything works okay when we are on our main multisite with domain maindomain. But when we visit otherdomain, there is a problem with fonts (and other static assets), because they are being served from maindomain, not otherdomain

Sage theme dist are served from maindomain.com/app/sage-theme/dist/.. instead of otherdomain.com/app/sage-theme/dist/..

Plugins are served from maindomain.com/app/plugins/plugin-name/plugin-assets instead of otherdomain.com/app/plugins/plugin-name/plugin-assets

Images are served from maindomain.com/app/uploads/sites/2 instead of otherdomain.com/app/uploads/sites/2

I did come across a WordPress ticket that could be related to the problem: https://core.trac.wordpress.org/ticket/25650

But I am not entirely sure if it’s not the problem in the Sage theme itself…

Here is the config:

Config::define('COOKIE_DOMAIN', '');
Config::define('ADMIN_COOKIE_PATH', '/');
Config::define('COOKIEPATH', '');
Config::define('SITECOOKIEPATH', '/');

Config::define('WP_DEBUG', false);
Config::define('WP_DEBUG_DISPLAY', false);
Config::define('WP_DISABLE_FATAL_ERROR_HANDLER', false);
Config::define('SCRIPT_DEBUG', false);
Config::define('DISALLOW_FILE_MODS', true);

Config::define('WP_ALLOW_MULTISITE', true);
Config::define('MULTISITE', true);
Config::define('SUBDOMAIN_INSTALL', false);
Config::define('DOMAIN_CURRENT_SITE', 'maindomain.com');
Config::define('PATH_CURRENT_SITE', '/');
Config::define('SITE_ID_CURRENT_SITE', 1);
Config::define('BLOG_ID_CURRENT_SITE', 1);

All info and feedback will be appreciated! Thanks!

  • How are you serving the fonts? I don't see any font loading code in your question, can you update it to explain how the fonts are being loaded/included on the page? I read the linked Trac ticket, but I also don't see any use of the switch_to_blog and restore_blog functions in your question. Please update your question using the edit button, there isn't enough information to answer this – Tom J Nowell Sep 16 at 10:29
  • Its the problem of serving the dist folder where there are all assets of the Sage (Roots) theme and serving all plugins files. The fonts alone are not only problem. I edited and added path from where are assets served – Nejc Rodošek Sep 16 at 10:40
  • It's likely because you set DOMAIN_CURRENT_SITE, that Trac ticket is unrelated to your problem – Tom J Nowell Sep 16 at 10:46
  • @TomJNowell so the correct practice is to leave DOMAIN_CURRENT_SITE empty on multi-domain multisite? – Nejc Rodošek Sep 16 at 10:47
  • Try not defining it – Tom J Nowell Sep 16 at 10:49

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.