 <p>The URL should be HTML encoded, and the query string values should be URL encoded.</p> <p>The <code>&amp;</code> should be HTML encoded as <code>&amp;amp;</code>, and <code>:</code> and <code>/</code> in the values should be URL encoded as <code>%3A</code> and <code>%2F</code>:</p> <pre><code>href="http://secure.hostgator.com/~affiliat/cgi-bin/affiliates/clickthru.cgi?id=vpspricing&amp;amp;page=http%3A%2F%2Fwww.hostgator.com%2Fvps-hosting" </code></pre> <p>Breakdown: First the values <code>vpspricing</code> and <code>http://www.hostgator.com/vps-hosting</code> are URL encoded into <code>vpspricing</code> (no change) and <code>http%3A%2F%2Fwww.hostgator.com%2Fvps-hosting</code> so that you can put them in the URL. Then you HTML encode the entire URL so that you can put it in the attribute in the HTML code. It's only the <code>&amp;</code> character that needs to be HTML encoded in this case.</p>