How To Prevent Affiliate Links From Getting Indexed In Search Engines

Search Engine Optimization or SEO is important for any blog or website. That’s why ThirstyAffiliates provide features to add additional rel tags to your affiliate links so you can control additional attributes about those links.

While we have a dedicated option for “nofollow” that doesn’t always stop your links getting indexed in the SERPs these days.

If you want to be sure that your affiliate links have the least chance of getting indexed in the search engine result pages, you need to put a rel=”noindex” to your affiliate links.

There are two options on how to add the “noindex” rel tag:

1. Globally add the “noindex” rel tag

In the ThirstyAffiliates > Settings > Link Appearance, we have a setting called Additional rel attribute tags where you can add the “noindex” rel tag to prevent all of your affiliates links from getting indexed on search engines.

2. Apply “noindex” rel tag to your individual links

Alternatively, there’s also the Link Options located in your individual affiliate link settings. This gives you an option to choose which specific affiliate links you want to add the “noindex” rel tag to.

NOTE: Once this setting is applied, you need to wait a few days for Google/other search engines to recrawl and reindex your site.

It’s worth mentioning that you also need to make sure the Googlebot is not blocked so they can crawl your site so they can find the rel=”noindex” tags. Please make sure that you don’t block it via robots.txt and the Enable Bot Crawl Blocker Script is unchecked on ThirstyAffiliates > Settings > General.

3. Add ‘noindex’ to HTTP headers on redirect

Google sometimes will not 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.