1

If have to urls A = https://a.example/foo and B = https://b.example/bar where I consider A as preferred URL and not B. In fact, all B does is send a 302 redirect to A (and it is rather something like an URL shortener for a limited semi-internal user base). Nevertheless, I discovered that A is listed in Google's webmaster console as not indexed because of "Duplicate without user-selected canonical". The URL checker then reveals that Google considers B as canonical version for the content.

Q: How can I prevent this and gently (or rather firmly) nudge Google into picking A as most relevant version?

  • Given that B is only a redirect, I suppose there is no sense in adding any no-index stuff to it?
  • Given that I rather wish the world as a whole to ignore B completely, I doubt it would be wise to add B as rel="alternate" to A (also, this would be a bit challenging for reasons of dynamic)
  • I might try do expel bots from B with a 401 based on their user agent string or reverse DNS lookup, but I am afraid that this might cut off "google juice", may cost performance due to DNS lookups, is not failsafe, does not apply to other search engines.

And of course a solution that is not Google-specific would be most welcome.


EDIT: After closer inspection of the Google console for server b.example, I am beginning to suspect that this is all just a bug in Google's data and will sort out in due time (which may mean several month). For I noticed that, during the last six weeks or so, a slowly growing (but still very tiny) number of B-type URLS on b.example do no longer appear under "valid", but rather under "excluded - page with redirect" (as seems appropriate). And it seems that indeed the redirection targets on a.example of these URLs do not suffer from the problem described above.

3

The answer is, ironically, in your title. [insert grin]

Use a canonical link.

You can read Googles page here: https://support.google.com/webmasters/answer/139066?hl=en

In the <head> section of b.example/bar, use a link like this:

<link rel="canonical" href="https://a.example.com/foo" />

Google will see that a.example.com/foo is preferred and will drop b.example.com/bar from the SERPs and add a.example.com/foo. This will take care of your duplicate content problem. This may take a while. Google is notoriously slow. So be very very very patient.

Keep in mind that it seems that Google Search Console seems to list errors forever. Check the date of any error showing in GSC. I have errors still showing for more than a year even though the problem was immediately solved. So please do not freak-out by what you see in GSC too much.

You may also want to change your 302 redirect to a 301. This should also help. A 302 tells the search engine that the page is "Found" whereas a 301 tells the search engine that the page has permanently moved. Here is a MOZ page on the subject. https://moz.com/learn/seo/redirection

  • 1
    Hm, but as of now the "b" page does not even have any html content (i.e., only http headers, not a html <head>) - the only actual content is served from "a". Following the Google page, I think I'll go with the Link: header (with rel=canonical) – Hagen von Eitzen Sep 29 at 8:56
  • Sounds good to me! Cheers!! – closetnoc Sep 29 at 14:29

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.