Affiliate cloak

Affiliate cloak

30 on our All-around SEO training! We regularly consult for sites that monetize, in part, with affiliate cloak links. We usually advise people to redirect affiliate links.

In the past, we noticed that there wasn’t a proper script available online that could handle this for us, so we created one to tackle this problem. In this post, I explain how you can get your hands on it and how you can get it running on your website. Why should I cloak my affiliate links? A quick online search will result in tons of reasons as to why you should redirect your affiliate links. It would be naive to think that search engines don’t understand what’s happening, but nevertheless this seems like a valid reason. Sometimes you might need to change your affiliate links. If said links are spread out across your blog, this could become a quite time-intensive task.

By centralizing the affiliate links, you have one location to manage all of them. Instead of having to do this manually for every individual affiliate link, you can do this is a single location without much hassle. This also prevents the possibility of forgetting to add nofollow to one of the links. Different affiliate programs tend to use different permalink structures. Using the redirect script can help you deal with this issue because the cloaked URL will always follow the same structure. This makes it a lot clearer for the user where the link is taking them to!

Create a folder from where you’ll serve your redirects. Use a script in your redirect folder to redirect to your affiliate URLs. Step 2 ensures search engines won’t follow the redirects, but we’ll add some extra security measures in our script to prevent accidental indexation of our affiliate links. Step 3 is as easy as manually adding each redirect to your redirect directory’s . Alternatively, you can use the script we produced to make it easier on yourself. Affiliate link redirect script The script we created consists of three files, one of which is optional: an index. This file contains the logic that handles the actual redirection by performing a 302 redirect.