In this tutorial I’ll show you how to make your affiliate links work much faster. It’s extremely useful if you use a redirect plugin or an affiliate link management plugin which started to work very slowly for you (this was exactly my case).
One day I found out that my affiliate links started working very slowly. Visitors clicked my affiliate links, and it took tens of seconds before the destination pages opened. It meant that I could be losing my income, not to mention irritating my readers. Degrading my website usability was obvious.
Long story short, it was due to a slowness of redirect plugin that I used. But before I got to know about it, all I knew was that for some reason the redirects initiated by my affiliate links management plugin worked awfully slowly.
The slowness of my affiliate links was a huge and unexpected disappointment for me. I worked hard to created useful content about hosting, website security, website backups and other stuff which contain affiliate links (this is the way I earn with my website). And loosing my income because of this technical glitch was annoying.
And what you see above was not the slowest metrics 🙂 Any affiliate link on my websites worked beyond all bearing slowly.
I had to fix it.
And I made my affiliate links work as fast as possible in a secure way, staying under Google radar and not losing SEO link juice and keeping them clean and nice-looking.
The secret is quite simple: get rid of the plugin that manages your redirecting to affiliate websites. Because it’s very likely (the proof of the concept is below) that the cause of the slowness of affiliate links redirecting is the plugin. And just use as simple method of redirecting as possible without using plugins which are the parts of the slower WordPress infrastructure.
But at the same time preserve your SEO link juice, keep your affiliate links nice and clean, secure and unnoticed by Google (which can penalize you if you don’t cloak your affiliate links properly). You will know how to do it in this tutorial.
Yes, you also get rid of many sweets that your affiliate links management plugin has such as stats, charts, affiliate links management from your WordPress dashboard etc. But in return you get speed of your affiliate links which do not depend on your WordPress. And it matters a lot for your visitor who is a potential buyer of the products that you promote as an affiliate.
Also, you will need to manage your affiliate links in a plain text file stored on your server. (You will need access to your files on your hosting, e.g. using cPanel or FTP). It’s very easy as you’ll see it below.
Basically, I took this method from Joost de Valk who also suffered from very slow affiliate links. Joost introduced this method in his blog post, which has all the information you actually need if you are tech-savvy enough. However, I found out that the instructions there are not comfortable for many unexperienced users. And that’s why I decided to make this easy tutorial.
Before you say good-bye to your favorite affiliate links management plugin or redirect management plugin, it’s a good idea to test how fast your bare simple redirects from your website work. This kind of redirect (302 Redirect) will not request database or run any script. You can add the redirect rule to your .htaccess file to check out its speed (I’ll show you below how to do it).
In other words, if 302 redirect to your affiliate link works much faster, then the bottleneck of your current speed issue is the plugin. And the method explained in this tutorial will help you greatly.
And if a bare 302 redirect works as slow as when using your plugin, then the problem is in your hosting, your affiliate marketing network or your destination (affiliate) website itself.
Here’s the practical part of how to test if it is worth to replace your affiliate links management plugin with the 302 redirect method described in this article. Also see a video tutorial below.
- Make a backup copy of your .htaccess file (it’s located in your public_html folder in your hosting account). It’s a good idea to have a backup copy of your .htaccess file (or the whole backup of your hosting account) in case something goes wrong.
If you can’t find your .htaccess file, make sure that hidden files are displayed.By the way, if you want a reliable backup solution for your website or whole hosting account, have a look at this in-depth comparison.
- Add the following code at the very beginning to your .htaccess file:
Redirect 302 /tmpredir http://your_affiliate_link
And replace http://your_affiliate_link with your real affiliate link.
The URL slug “tmpredir” is just any unique word that is not used as a URL slug on your website (in other words, http://yourwebsite.com/tmpredir should not exist before).
So, for example, my 302 redirect rule for WPEngine hosting affiliate program looks like this:
Redirect 302 /tmpredir http://wpeng.in/researchasahobby/
Here’s how my .htaccess file looks like after adding this code:
- Now your redirect test is ready. Test its speed. Open a new browser window and enter http://www.yourwebsite.com/tmpredir (replace http://www.yourwebsite.com with your website URL). In my case it will be http://researchasahobby.com/tmpredir.
Then your affiliate product web page should appear. Notice how much time it took for your browser to open your redirect link. For more objective results (in order to avoid your browser caching etc) I suggest using a free service webpagetest.org that tests the speed of the link to open.
- Compare the time with the time it takes for your previous affiliate link (generated by your affiliate links management plugin) to load. If the new redirect link works much faster, then you have proved the concept. And you can surely use the method described in the tutorial below to make your affiliate links faster.
- Remove the redirect code from your .htaccess file that you created on Step 2. Or restore the backed up copy of .htaccess. You don’t need the test redirect code any more.
So, if you have proved that bare simple 302 redirect works faster than using your slow affiliate links management plugin (or your redirect management plugin), then see below the main part of the tutorial – how to get rid of the plugin and replace it with speed-efficient and secure redirects.
Here’s a video tutorial that includes also the steps described in the above chapter (Proving the concept before you get rid of your affiliate links management plugin)
And here’s a text version of the tutorial:
- Create folder in your public_html (e.g. “/go/“). So, your new affiliate links on your website will look like http://yourwebsite.com/go/product/
- Block this new folder for web crawlers in your robots.txt (located in your public_html folder) by adding
User-Agent: * Disallow: /go/
This will help to add extra layer to hide your affiliate links from search engines and other crawlers.
If you don’t have robots.txt file, create it.
- Add to your new folder (e.g. /go/) a special .php script to handle redirects safely for your SEO rankings. Also add .htaccess file for your new folder (/go/). And add a sample text file (redirects.txt) with a list of the redirects that you can easily manage. You can download all these files here. You can also see the code of the files on gitgub here.
If you can’t upload the sample .htaccess file to your server, make the unhidden (i.e. rename it to remove the dot at the beginning. For example, rename it to htaccess.txt and then you will be able to upload it. But then rename it back to .htaccess on your server.
By the way, .htaccess file works on Appache server (if you are not sure what it is, don’t worry, it’s very likely that it is your case, since most shared hosting use Apache or can support .htaccess files).
Anyway, here’s the gist file for NGNIX server in case you need it.
- Edit the redirects.txt file:
- Remove from it everything but the first line (i.e. leave default,http://example.com). And replace http://example.com with your website URL (forexample, in my case this this line looks like this: “default,http://researchasahobby.com“). This line handles incorrect redirects to avoid 404 Error (Page Not Found).
- Add a test redirect line to see if it works. For example, add line “tmpredir2,http://google.com“:
Thus, if you now enter http://yourwebsite.com/go/tmpredir2 in a browser, it should redirect you to google.com website.
Note that the URL slug “tmpredir2” should be a unique word that is not used as your URL slug on your website (in other words, http://yourwebsite.com/go/tmpredir2 should not exist before)
- If the test redirect to google.com works, then everything is fine. Then you can remove this test tmpredir2 line from redirects.txt and add there other lines with URL slugs and your afiliate URLs.
Your final redirects.txt file may look like this:
And finally, just add additional level of protection of your SEO link juice, use rel=”nofollow” tag when putting your links to your website (blog post, page etc). For example, html code of my affiliate link for one of the hosting I recommend look like this:
<a href="http://researchasahobby.com/go/wpengine" target="_blank" rel="nofollow">Link to WP Engine</a>
That’s it! Now your redirects will be handled quickly without using WordPress and your slow affiliate links management plugin.
This redirect method will definitely make your redirects faster because it does not use WordPress or its plugins. The speed is very important particularly for your affiliate links. No one wants to wait many seconds for your affiliate product’s page to open.
This is very useful if you use redirects management plugin or affiliate links management plugin which sometimes start working very slowly. In this case this method can improve the speed of your affiliate links by many times.
And this method provides a secure (protected from Google’s eyes) redirecting to your affiliate links. In other words, it cloaks your affiliate links safely.