Written by Barry Schwartz and first appearing on Search Engine Roundtable
Google’s John Mueller said you should absolutely not “use robots.txt to block indexing of URLs with parameters.” He said if you do that then Google “cannot canonicalize the URLs, and you lose all of the value from links to those pages.” Instead use rel-canonicals and link consistently throughout your site.
John said this on Twitter, here is an embed of the tweet:
He then had a follow up about why it is so bad to block these URLs with robots.txt:
We wouldn’t see the rel-canonical if it’s blocked by robots.txt, so I’d pick either one or the other. If you do use robots.txt, we’ll treat them like other robotted pages (and we won’t know what’s on the page, so we might index the URL without content).
So be careful about this and double check all of these things on your web sites.