title: Using Rel=Canonical Vs. Robots.txt Vs. META robots to prevent duplicate content indexing?
body: <p>I want to construct a website I'm building in a way that would distinguish between visitors coming from organic sources (e.g, Google search), and paid sources (e.g, Google adwords).</p>
  <p>Whenever a visitor would perform some sort of action, it would carry a string that would help me identify the source. I'm using PHP, and I suppose I would construct the website this way:</p>
  <p>A. In general, all internal links in the website would never carry a string in their URL, so by default, every action would carry some default variable.</p>
  <p>B. for paid traffic, visitors would reach a <code>domain.com/page.php?source=paid</code> type url, which would modify the default string to something else.</p>
  <p><strong>My concern:</strong></p>
  <p>I want to prevent Search engines form mistakenly index both <code>index.php</code> and <code>index.php?source=paid</code>, which could cause my website to allegedly have duplicate content and hurt my rankings.</p>
  <p>if it matters, for the whole website, I want to use some re-write rule, making my links look cleaner, e.g, <code>domain.com/subscribe.php</code> -&gt; <code>domain.com/subscribe</code>, so the solution needs to be compatible with this as well (in case it could hinder anything).</p>
  <p><strong>I have thought about the following approaches to avoid this problem,
  and would like to know which one should I pick, or combine, or whether there's an alternative:</strong></p>
  <ol>
  <li><p>Simply place:</p>
  <p><code>&lt;link rel=&quot;canonical&quot; href=&quot;http://www.domain.com/page.php&quot; /&gt;</code> In the head of each <code>page.php</code>. according to <a href="http://googlewebmastercentral.blogspot.co.il/2009/02/specify-your-canonical.html" rel="nofollow noreferrer">Google blog</a>, Bing and Yahoo should also respect that. not sure though if that would 100% prevent pages from getting indexed, or just does something to &quot;link juice&quot;.</p>
  </li>
  <li><p>Add this rule to robots.txt:
  <code>Disallow: /*?*</code> - Does this mean every url containg a <code>?</code> would never get indexed (such as <code>domain.com/page.php?source=paid</code>, but <code>domain.com/page.php</code> would indeed get indexed? I don't need to positively &quot;allow&quot; anything at the same time, right?</p>
  </li>
  <li><p>Use PHP IF/Else to do this:
  Check if the string <code>source</code> contains any value whatsoever. If it does, modify the <code>META robots</code> to <code>&lt;meta name=&quot;robots&quot; content=&quot;noindex, nofollow&quot; /&gt;</code>.
  Else, (If it the url was reached without any string), modify the tag to be <code>&lt;meta name=&quot;robots&quot; content=&quot;index, follow&quot; /&gt;</code></p>
  </li>
  </ol>
  <p>Thanks!</p>