• Resolved sinusiks

    (@sinusiks)


    We are using LSCWP on a Woocommerce store that uses WPML for multi language. It is configured in a way that every language is on it’s own domain (1 primary language + 2 additional languages = total 3 domains). This is on single WP installation (NOT a multi-site) and it works fine at first glance except:

    • If I purge all cache, it only purges the cache of the domain where I am logged-in. If I want to purge all caches from all three domains, I have to log-in to wp-admin on every domain and click purge all
    • all JS and CSS files are loaded on all domains from default language domain (e.g. example.com), even if user is visiting otherdomain.com (e.g. https://example.com/wp-content/litespeed/js/69ec2a34e5d93e4eca8d2b7db5376f5a.js?ver=ba5b8). It would not be a problem but when something changes on the default language, a new JS / CSS files are generated while other languages still have old css/js URLs cached which breaks these sites and produces 404 errors for those JS / CSS requests. The only solution is to log-in in wp-admin on every single domain and click “purge all” so it builds a new cache with updated JS/CSS urls

    I searched for any advice, some say that Toolbox > Purge > “Empty entire cache” should clear cache for all pages, but it does not – it only clears cache of the current domain, I still have to manually log-in to wp-admin on every secondary domain and click purge all for cache to be cleared. Note that this is not a multi-site WP installation but WPML that serves different language on every domain.

    Is there any workaround so all three domains cache would be cleared when default language’s domain cache changes? Maybe some hook where I can manually force all domain’s caches to be cleared when there is a change in one of them? That would be sufficient – I realize it’s not an optimal solution, but still better than users coming to other domains and getting 404 errors and javascript not working for them.

    Is there any way for JS / CSS files to be loaded from the domain where user is visiting and not from default language’s domain?

    I already tried Toolbox > Debug settings > Disable all features, but it disables those features only on default language domain while other domains/languages still serve obsolete cached copies of the website.

    • This topic was modified 2 years, 1 month ago by sinusiks.
Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Support qtwrk

    (@qtwrk)

    May I know if this is a cPanel or something ?

    are these domains pointed to same vhost ?

    Thread Starter sinusiks

    (@sinusiks)

    No it’s not a cpanel, it is openlitespeed server on cyberpanel on Ubuntu VPS. One domain is “primary” while others are added as add-on domains (child domains). But your question prompted me to check the configuration a bit more so I tried to define other domains as alias domains instead of child domains. That way there is only one vhost that has multiple domains defined in listener mappings.
    I will monitor if this helps as now I also see that the cache is only being built for the primary domain in /usr/local/lsws/cachedata – before it was separated for all 3 domains (separate subfolders)

    This still doesn’t fix the issue that combined JS/CSS files are still served from primary domain but I guess it may fix cache clearing problems.

    Plugin Support qtwrk

    (@qtwrk)

    for domain JS/CSS

    you can try this , add this to your wp-config.php

    if ($_SERVER['SERVER_NAME'] == 'yourdomain.de') {
    define( 'LITESPEED_STATIC_URL', '//yourdomain.de/wp-content/litespeed' ) ;
    }
    elseif ($_SERVER['SERVER_NAME'] == 'yourdomain.fr') {
    define( 'LITESPEED_STATIC_URL', '//yourdomain.fr/wp-content/litespeed' ) ;
    }
    elseif ($_SERVER['SERVER_NAME'] == 'yourdomain.es') {
    define( 'LITESPEED_STATIC_URL', '//yourdomain.es/wp-content/litespeed' ) ;
    }

    this will define that URL prefix manually before plugin defines it

    if you are using QUIC cloud online service/CDN , you may need to to QC dashboard -> your domain -> setting -> domian alias , add these domains into the alias list

    Thread Starter sinusiks

    (@sinusiks)

    Great solution, thank you! This fixed CSS / JS from loading from another domain. After we changed the domains configuration (they are now configured as alias instead of child domains in cyberpanel) it also fixed our problems of cache not clearing up so it seems all problems are resolved.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘WPML + multi domain cache clean-up’ is closed to new replies.