Situation when the same page has different Statuses: Canonical and Canonicalised when crawled from the different countries

I need to show different content to the visitors from USA. I am using the following code in .htaccess to capture CloudFlare Geolocation data and append "/?country=US" to my URL once visitor came from USA:

SetEnvIf CF-IPCountry "(.*)$ " Country=$ 1
RewriteCond %{ENV:Country} ^(US)$
RewriteRule ^(.*)$ $ 1?country=%{ENV:Country} [R,L,QSA]

So basically all Americans seeing while rest of the world seeing:

Everything works as planned, the only concern I have …

US based bots (Google Search Console) now seeing this page as following:

  • – StatusCode: 302, Status: Found, Indexability: Non-Indexable, Indexability Status: Redirected
  • – StatusCode: 200, Status: OK, Indexability: Non-Indexable, Indexability Status: Canonicalised

For the rest of the world:

  • – StatusCode: 200, Status: OK, Indexability: Indexable, Indexability Status: Canonical

As you may see from above "" now has TWO different Responses when crawled in the US and outside of US.


  • Do you see any danger from SEO perspective? Is there any way to avoid this situation when the same page ( has TWO different Statuses: Canonical and Canonicalised when crawled from the different countries?
  • Will you recommend a different approach to this problem, maybe by avoiding the use of a querystring?

Thanks a lot! OZ

Do rel canonical tags permanently affect link juice, or can they be undone later?

Does placing the rel=canonical tag pass the link juice to the canonicalised page forever? What I’m trying to say is, if one were to canonicalise page b to page a, would then reverting that change (for turning it into its own page lets say) leave some link juice and hence ranking "power" behind on page a or would b simply retain all that it had transferred via the canonicalisation signal it had sent to Google?

Is it ok to set new canonical url in product variations group

Ecommerce shop has different pages for different product sizes:

  • /shirt-size-s/
  • /shirt-size-m/
  • /shirt-size-xl/

They all point to /shirt-size-s/ as canonical and only this page goes to sitemap.xml

What should happen when /shirt-size-s/ goes out of stock, but sizes M and L are still available? I guess I should:

  1. Remove /shirt-size-s/ from sitemap
  2. Add /shirt-size-m/ to sitemap
  3. Set canonical to /shirt-size-m/

Is this the best practice with current site structure?

Duplicate without user-selected canonical but its the Google canonical

Google search console lists in the excluded section because it is "Duplicate without user-selected canonical". When I inspect the URL, it says

User-declared canonical       None Google-selected canonical     Inspected URL 

So it seems like google thinks it is the canonical URL. Do I still need to make it user declared canonical, and if so, how do I do that?

Canonical solution of a scoping problem

Scoping is a recurrent issue on this forum.

Yet, I stumble again and again at the same thing. Googling over this site does not quickly bring a solution. Two reasons:

  1. There are many low quality answers such as this one (and I can elaborate on this, if needed).
  2. There are many very good answers (this and this), but they are too long.

Sometimes I just want to learn by examples, not by reading many pages of dry theory. Therefore I would like to ask this question again even at risk being downvoted or the question being closed.

Consider this code

ClearAll[g,i,list];  list=Range[3] g[l_]:=Module[{i},l/.{i_->2i}]  g[list] i=5 g[list]  Out[2]= {1,2,3} Out[4]= {2,4,6} Out[5]= 5 Out[6]= 10 

Or a very similar one

ClearAll[g,i,list];  list=Range[3] g[l_]:=Cases[l,i_->2i]  g[list] i=5 g[list]  Out[8]= {1,2,3} Out[10]= {2,4,6} Out[11]= 5 Out[12]= {10,10,10} 

It is clear to me that setting the global variable i interferes with the function definition. I would like to know what is the canonical way of avoiding this interference?.

Please, avoid answer like 2 list.

Disable/ Remove canonical tag generated by wordpress

There is problem in my wordpress site. It is showing duplicate canonical URL issue because yoast and wordpress or some other plugin both are creating canonical tag. I have tried to remove the canonical tag generated by yoast on a specific page but that started showing other duplicate content issues. So I want to disable the canonical tag generated by WordPress or any other plugin. I have tried remove_action(‘wp_head’, ‘rel_canonical’); which is not working.

Duplicate content, canonical url and json-ld Article

If I have a duplicate content, which URLs should I use in json-ld Article schema? To be precise, let’s say I want to publish an article from my on another site e.g. When I publish the article on I go and update canonical URL on my, and og:url property (both should be same as implied here):

<!-- this is on --> <link rel="canonical" href=""> <meta property="og:url" content="" /> 

I also use to describe the Article entity, however, usually all URLs within it point to my own

<!-- this is on --> <script type="application/ld+json">   {     "@context": "",     "@type": "Article",     "author": {       "name" : "Gitnik"     },     "headline": "My Duplicate Article",     "description" : "Uhm, how do I deal with Article entity in case of duplicate content?",     "inLanguage" : "en",     "wordCount":  600 ,     "datePublished" : "2020-05-18T21:00:00",     "dateModified" : "2020-05-18T21:00:00",     "image" : "http:\/\/\/img\/logo.png",     "mainEntityOfPage" : "http:\/\/\/2020\/05\/my-duplicate-article\/",     "publisher" : {       "@type": "Organization",       "name" : "http:\/\/\/",       "logo" : {           "@type" : "ImageObject",           "url" : "http:\/\/\/img\/logo.png",           "height" :  60 ,           "width" :  60       }     }   }   </script> 

but Google states that mainEntityOfPage should be same as canonical URL. Now, it’s easy to update mainEntityOfPage to the new url. But what about image url and organization? Can image url point to a location other than canonical url? And should I change Organization entity to the and change the url there also? How would it affect SEO if I left them unchanged? How would it affect SEO if I left mainEntityOfPage unchanged?

Right use of canonical when using URL parameters?

On certain pages of my website I use URL parameters on links:

<a href="/example/?parameter=value">Click here</a> 

The target URL is always exactly the same (i.e. /example/). With exactly the same content.

The URL parameter only serves the purpose of being used as a hidden form field in a form on that page. So that I can identify the page the user has visited before actually submitting that form.

My question: How do I correctly set the canonical to prevent the target page to be indexed multiple times?

Only on the actual target page in the head like this?

<link rel="canonical" href="" /> 

Or should I also do it on the actual original link? How would I ideally solve this?

Currently, the tool claims those pages as “Duplicate pages without canonical” although I have already set the self-referencing canonical on the target page like this <link rel="canonical" href="" />.

Hreflang and canonical problem on session parameters

We have a oxid onlineshop with different domains/subdomains depending on currency and language.

Now we have a problem with hreflang tags, because of parameters

1) the session of the basket between domains is set by ?force_sid=(random string for session id)

2) for different views in categories like ?ldtype=grid&_artperpage=100&pgNr=0&cl=alist&searchparam=&cnid=3ae4a2e1dd7501139.35363255

if the url is accessed without the parameters then the canonical and hreflang tags are correct.

If the parameters are set then the canonical and hreflang tags are wrong.

What are the correct tags for example: ?

We have:

<link rel="canonical" href=""> <link rel="alternate" hreflang="x-default" href=""> <link rel="alternate" hreflang="de" href=""> <link rel="alternate" hreflang="de-CH" href=""> <link rel="alternate" hreflang="fr-CH" href=""> <link rel="alternate" hreflang="de-AT" href=""> <link rel="alternate" hreflang="fr" href=""> <link rel="alternate" hreflang="en" href=""> <link rel="alternate" hreflang="es" href="">