TOPIC: Exclude static subdomain.

Exclude static subdomain. 19 Feb 2014 13:05 #616

Hi I use a static subdomain, static.domain.com and i want jotchache to not cache pages with this subdomain. Is that possible and if it is how?


Thank you.


Joomla version : 2.5
JotCache version : 4.1
site template:
system plugins :
The administrator has disabled public write access.

Re: Exclude static subdomain. 25 Feb 2014 07:35 #640

JotCache has no multidomain feature to distinguish different (virtual) domains on the site.
The administrator has disabled public write access.

Re: Exclude static subdomain. 29 Jul 2015 10:19 #1422

Hi, I found hacks to solve this problem, but I am using joomla1.5 and it's latest jotcache plugin so this hack may be useless for latest jotcache plugin. However I introduce this for those who still using j1.5 like me.

This hack is NOT for disable cache subdomain but for distinguishing caches by each subdomain. If you want to disable cache for particular subdomain, set browser name empty by subdomains by using this hack's approach.

MAKE SURE THIS IS CORE FILE HACK, YOU NEED TO TRY THIS ONLY WHEN YOU KNOW WHAT YOU DO.


This hack to distinguish caches by subdomains by creating custom browser name for each subdomains.

2 files to be hacked;

/plugins/system/jotcache/phpUserAgentStringParser.php
/plugins/system/jotcache.xml

1st step: phpUserAgentStringParser.php

Line 9: function parse()
Add this to get current subdomain;

----
// Set empty variable
$addsubd = '';
// Get current subdomain
$subdomain = array_shift((explode(".",$_SERVER['HTTP_HOST'])));
// Set the variable current subdomain
if ($subdomain === '<YOURSUBDOMAIN1>' || $subdomain === '<YOURSUBDOMAIN2>')
{
        $addsubd = $subdomain;
}
----

Then edit browser name with subdomain both for phone and tablet;
'string' => $clean,
'browser_name' => 'tablet'. $addsubd ,
'browser_version' => null,
'operating_system' => null,
'engine' => null

Also pass subdomain to the method to create browser name for all others from phone/tablet.
$informations = $this->doParse($userAgentString,  $addsubd );

Add the following code at the bottom inside the mothod, doParse();
if ($addsubd === '<YOURSUBDOMAIN1>' || $addsubd === '<YOURSUBDOMAIN2>')
{
        $userAgent['browser_name'] = $addsubd;
}
return $userAgent;


2nd step: jotcache.xml

You can add your customized browser name for plugin setting.
Add options inside ;
<param name="cacheclient">
<option value="<YOURSUBDOMAIN1>"><YOURSUBDOMAIN1></option>
<option value="<YOURSUBDOMAIN2>"><YOURSUBDOMAIN2></option>
<option value="tablet<YOURSUBDOMAIN1>">tablet <YOURSUBDOMAIN1></option>
<option value="phone<YOURSUBDOMAIN1>">phone <YOURSUBDOMAIN1></option>
<option value="tablet<YOURSUBDOMAIN2>">tablet <YOURSUBDOMAIN2></option>
<option value="phone<YOURSUBDOMAIN2>">phone <YOURSUBDOMAIN2></option>

then log in to joomla backend >> plugins >> jotcache >> browser split >> select any you want to distinguish cache contents.

In this way you can virtually set different cache contents by subdomains as many as you want. If you set browser name empty, you can disable jotcache for that.

Best, and thank you for this great components.

Joomla version : 1.5
JotCache version : 3.x
site template:
system plugins :
The administrator has disabled public write access.
Time to create page: 0.247 seconds
We have 72 guests and no members online
Copyright © 2015 JotComponents
We have 72 guests and no members online
Copyright © 2017 JotComponents