1. Home
  2. Knowledge Base
  3. ThirstyAffiliates (Free Version)
  4. How To Add Noindex HTTP Headers To Affiliate Link Redirects

How To Add Noindex HTTP Headers To Affiliate Link Redirects

Google sometimes doesn't view rel=”noindex” as a valid way to tell if the page should be shown in their index or not.

The newest and most reliable way to ensure that your affiliate links are not indexed is by adding noindex to the HTTP response headers during redirection.

This snippet of code will do the job:

function ta_add_noindex_headers() {
    header( 'X-Robots-Tag: noindex, nofollow' );
}

add_action( 'ta_before_link_redirect' , 'ta_add_noindex_headers' );

You need to add this snippet to your functions.php or in a drop in plugin.

In future, we will add this as a feature to our plugin.

Was this article helpful?

Related Articles

Need Support?

Can't find the answer you're looking for?
Contact Support