Mobile app version of vmapp.org
Login or Join
Holmes151

: Multi country redirect working with google I have company.com, us.company.com and ca.company.com, all using the same language, however, displaying different content e.g. pricing, imagery and text

@Holmes151

Posted in: #Geolocation #Geotargeting #Google #Internationalization #Wordpress

I have company.com, us.company.com and ca.company.com, all using the same language, however, displaying different content e.g. pricing, imagery and text

I want the site to be displayed in Google as company.com but if the user is in the US and clicks company.com they are redirected to us.company.com.

The sites are WordPress and I have the redirects working using CloudFlare - see code below.

<?php
$country_code = $_SERVER["HTTP_CF_IPCOUNTRY"];

if($country_code == 'CA') {
header("Location: ca.company.com , true, 301);
exit();
}
if($country_code == 'US') {
header("Location: us.company.com , true, 301);
exit();
}
?>


Currently when searching Google for company.com, us.company.com comes up no matter the location of the user and company.com is nowhere to been seen.

I have Webmaster Tools set up for company.com and as of yesterday added us.company.com but not 100% sure if this is the way to go... I am new to this kind of set up and I could have gone about it completely wrong, so any help/advice would be greatly appreciated.

10.02% popularity Vote Up Vote Down


Login to follow query

More posts by @Holmes151

2 Comments

Sorted by latest first Latest Oldest Best

 

@Michele947

Besides the conditional redirect, what steps have you taken to target these sites at their intended markets?

From what you've said, I suspect you don't have geotargeting set up in Search Console / Webmaster Tools. You'll need to verify both the us. and ca. subdomains, and set each to target their respective markets.

In addition, you should look into hreflang markup, which allows you to target content at specific languages and locations. Introduction here.

While Google does advertise "locale aware" crawling (i.e. they use multiple IPs and Accept-Language headers in an effort to process setups like yours), the above steps are still recommended.

In general, you should assume that search engines crawl from a single location and do not send Accept-Language headers, and so can't process IP and language detection without help.

10% popularity Vote Up Vote Down


 

@Looi9037786

Maybe with fallback?

<?php
$country_code = $_SERVER["HTTP_CF_IPCOUNTRY"];

if($country_code=="CA"){
$location='http://ca.company.com';
}elseif($country_code=="US"){
$location='http://us.company.com';
}else{
$location='http://company.com';
}
header("location:$location",true, 301);
exit;

?>

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme