Page 1 of 1

Solution - Multi Site with google Analytics Guide

Posted: Mon Jul 14, 2008 10:20 am
by Phoenix
1.Have domains pointing to main domain type where cms is installed

2. Changes to Config.php
#$config['root_url'] = 'http://'. $_SERVER['SERVER_NAME'];
$config['root_url'] = 'http://'. $_SERVER['HTTP_HOST'];

3. Set domain type in Template



{global_content name='domaintype'}

4. Create Global Content domain type
{* some initial setup *} {* strip www. dots and dashes from server host name and assign to a variable for later use *} {assign var=tldtype value=$smarty.server.HTTP_HOST|replace:'www.':''} {if $tldtype eq 'domain.co.za'}    {assign var=tld value='.co.za'}{* tld is this domains domain type *} {elseif $tldtype eq 'domain.com'}    {assign var=tld value='.com'} {elseif $tldtype eq 'domain.net'} {assign var=tld value='.net'} {else}    {assign var=tld value='.'} {/if} {* end setup *}

5. Use tld in site variables example below Google analytics* place in template
{global_content name="$tld-analytics"}
6. Create Global Content variable for each tld
.co.za-analytics



.com-analytics




Note Multi site seemed to work better by removing www via htaccess , better for SEO as well
#Remove www
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www.domain.net$ [NC]
RewriteRule ^(.*)$ http://domain.net/$1 [R=301,L]
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www.domain.co.za$ [NC]
RewriteRule ^(.*)$ http://domain.co.za/$1 [R=301,L]

External php still has issues even with UDT