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.

  $country_code = $_SERVER["HTTP_CF_IPCOUNTRY"];

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

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.


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.


Maybe with fallback?

$country_code = $_SERVER["HTTP_CF_IPCOUNTRY"];

header("location:$location",true, 301);


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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