Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

My project has two versions of the website - American and International. This is not localization, language is same, only content changes. I have created subdomain for the US version and kept international version on main domain.

Now, I googled for solutions to redirect US users to US website by default and used Geo redirect plugin (http://wordpress.org/extend/plugins/geographical-redirect/).

Now the problem, this plugin redirects visitors from US everytime they attempt to open the international version. What I need to do is, user should be redirected to the US version on first visit, then through a referrer link I put on US website, visitor should be allowed to visit the international version and surf the website. But again, if user tries to open website directly, he should be redirected to the US version.

How do I do that?

share|improve this question

1 Answer 1

up vote 2 down vote accepted

I would say use a $_SESSION['var'] var or $_COOKIE[] to check if the link is clicked. Looks like the plugin is calling the geo_redirect_client_location function and then redirecting.

function geo_redirect_client_location(){
    $geo = new Geo_Redirect();
    $geo->checkIfRedirectNeeded();
}

I'm not familiar enough with the plugin but I would so something like:

<a href="example-intenational-sitelink.com/?show_intl=true">Link on US site to show Intl site</a>

Then on the intl site:

If(isset($_GET['show_intl']) && $_GET['show_intl'] == "true"){
//set our cookie or session data here
}

Then modify/fork the plugin (or find the right hook)

function geo_redirect_client_location(){
if(!isset(Cookie or Session){    
    $geo = new Geo_Redirect();
    $geo->checkIfRedirectNeeded();
}
}

Basically this is just an overview of how I'd do it. You'll have to do you're own digging into the code to get it to work right

share|improve this answer
    
Thanks, I'll investigate that further. Another question, the way I am doing is the right way? Will this redirection impact SEO by any means? –  Nix Mar 2 '13 at 23:09

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.