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-indexstuff 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.