Re-direction based on referrer domain

For discussion and questions related to CMS Specific templates and stylesheets (CSS), and themes. or layout issues. This is not a place for generic "I don't know CSS issues"
Locked
mattandaniel

Re-direction based on referrer domain

Post by mattandaniel »

Hi there,

I am setting up a site to serve both Australia and New Zealand. The content for both sites is managed within the one CMSMS installation. Does anyone know what would be the best way to re-direct to the appropriate home page based on the referrer URL? That is, I want mysite.com.au to automatically redirect to the australia home page, and mysite.co.nz to automatically redirect to the NZ home page. I was thinking it may involve editing index.php...

thanks
mattandaniel

Re: Re-direction based on referrer domain

Post by mattandaniel »

In case anyone else needs to do this at some point, I created a user defined tag called 'redirect'. Here is what I put in it:

$domain = $_SERVER['HTTP_HOST'];

if( ($domain == 'www.mysite.com.au') || ($domain == 'mysite.com.au' ) )
{
          header( 'Location: http://www.mysite.com.au/index.php?page=mysite-au-home' ) ;
}
else
{
          header( 'Location: http://www.mysite.com.au/index.php?page=mysite-nz-home' ) ;
}

I then just put it in the content of the home page - seems to work pretty smoothly.
Locked

Return to “Layout and Design (CSS & HTML)”