• Hello its sounds more complex than it is.

    What we have:

    A WooCommerce Shop which is accessible under different domains and use different styles.

    I’m looking now for 2 possible ways:

    1.: tell the plugin which domain it should use(or use a domain prefix in filenames), maybe save the cache before in a extra folder, 1 per domain.

    Its not a multi site, we do the url rewrite on fly.

    OR:

    2.: filter the html data before it send out to the user so i can do a domain replace.

    Is here any filter possible? Thanks

    • This topic was modified 1 year, 4 months ago by stefanxyz.
    • This topic was modified 1 year, 4 months ago by stefanxyz.
Viewing 15 replies - 1 through 15 (of 24 total)
  • Thread Starter stefanxyz

    (@stefanxyz)

    When i understand it correct, the wpfc_buffer_callback_filter is what im looking for option #2?

    Tobad the sites on the different domain use different title and something else.

    Is it possible to separate the cache per domain?

    /wp-content/cache/all will be to /wp-content/cache/[domain]/all ?

    Or add a hook where i can set the cache dir?

    thanks

    Plugin Author Emre Vona

    (@emrevona)

    yes, it is possible to separate the cache per domain. Have you tried using the plugin and have problems? Or do you just want preliminary information?

    Thread Starter stefanxyz

    (@stefanxyz)

    hi Emre Vona,

    i have the plugin and looking for the information where/how i can do it.

    • This reply was modified 1 year, 4 months ago by stefanxyz.
    Plugin Author Emre Vona

    (@emrevona)

    you should try wp fastest cache. i guess it will work.

    Thread Starter stefanxyz

    (@stefanxyz)

    sure but its no default setting i think, the files goes to /wp-content/cache/all and are not separated by domain

    Plugin Author Emre Vona

    (@emrevona)

    Our plugin separates the cache per domain by default.

    Thread Starter stefanxyz

    (@stefanxyz)

    your sure? in my test i got the files from the .org domain supplied on the.store domain or do you speak about multi site? I dont use a multisite, i use multiple domains on the same site

    Plugin Author Emre Vona

    (@emrevona)

    I do not know what you are using but it may work. if it does not work, we can handle it.

    Thread Starter stefanxyz

    (@stefanxyz)

    how we can test it? i change the site onfly btw over the following filter

    add_filter(‘content_url’, ‘fixUrl’); add_filter(‘option_siteurl’, ‘fixUrl’); add_filter(‘option_home’, ‘fixUrl’); add_filter(‘plugins_url’, ‘fixUrl’); add_filter(‘wp_get_attachment_url’, ‘fixUrl’); add_filter(‘get_the_guid’, ‘fixUrl’); add_filter(‘upload_dir’, ‘fixUrl’); add_filter(‘the_content’, ‘fixUrl’); add_filter(‘upload_dir’, ‘fixUploadDir’);

    Thread Starter stefanxyz

    (@stefanxyz)

    cache.php

    $this->cacheFilePath = $this->getWpContentDir(“/cache/”.$type.”/”).$_SERVER[“REQUEST_URI”];

    this should include $_SERVER['SERVER_NAME'] or a hashed version of after my first view

    edit: works and create a own folder for every domain, would need only todo for the js/css

    • This reply was modified 1 year, 4 months ago by stefanxyz.
    Plugin Author Emre Vona

    (@emrevona)

    Thread Starter stefanxyz

    (@stefanxyz)

    ahh nice i see, and now i understand you with its creates them by default, you check for multiple-domain/multiple-domain.php and is_multisite then use the hostname. Can i ask you to add in line 1150 a filter where i can force set the is multi domain without having the multiple-domain.php installed? I can edit it but after update i have to edit it again. thank you

    Plugin Author Emre Vona

    (@emrevona)

    sure but I need to know which method you are using. is there any tutorial which you have read about it?

    Thread Starter stefanxyz

    (@stefanxyz)

    i was looking for but dont find it again, was copy and paste from GitHub.

    i use A records and all domain goes to my wordpress instance over IP, in my function.php i replace the domains in fixUrl over str_replace over the following filter:

    add_filter(‘content_url’, ‘fixUrl’); add_filter(‘option_siteurl’, ‘fixUrl’); add_filter(‘option_home’, ‘fixUrl’); add_filter(‘plugins_url’, ‘fixUrl’); add_filter(‘wp_get_attachment_url’, ‘fixUrl’); add_filter(‘get_the_guid’, ‘fixUrl’); add_filter(‘upload_dir’, ‘fixUrl’); add_filter(‘the_content’, ‘fixUrl’); add_filter(‘upload_dir’, ‘fixUploadDir’);

    Thread Starter stefanxyz

    (@stefanxyz)

    <?phpclass rewrite{    function __construct()    {        add_filter('content_url', [$this, 'fixUrl']);        add_filter('option_siteurl', [$this, 'fixUrl']);        add_filter('option_home', [$this, 'fixUrl']);        add_filter('plugins_url', [$this, 'fixUrl']);        add_filter('wp_get_attachment_url', [$this, 'fixUrl']);        add_filter('get_the_guid', [$this, 'fixUrl']);        add_filter('upload_dir', [$this, 'fixUploaddir']);        add_filter('the_content', [$this, 'fixUrl'], 20);        add_filter('upload_dir', [$this, 'fixUploadDir']);    }    function fixUrl($url)    {        return str_replace($this->orginalDomain, $this->domain, $url);    }    function fixUploaddir($param)    {        $param['url'] = str_replace($this->orginalDomain, $this->domain, $param['url']);        $param['baseurl'] = str_replace($this->orginalDomain, $this->domain, $param['baseurl']);        return $param;    }}$r = new rewrite();?>

    or here on Pastebin https://pastebin.com/56RQP3NM

    that is basically the magic. $this->orginalDomain is the domain from the config where the wp is installed, $this->domain is the wanted domain i want show.

    • This reply was modified 1 year, 4 months ago by stefanxyz.
    • This reply was modified 1 year, 4 months ago by stefanxyz.
Viewing 15 replies - 1 through 15 (of 24 total)
  • The topic ‘filter the cached output | own cache files?’ is closed to new replies.