Slow Redirect Plugin Or How To Make Affiliate Links Faster (Tutorial)

Share this!
Share On Facebook
Share On Twitter
Share On Google Plus
Share On Linkedin

Slow Redirect Plugin Or How To Make Affiliate Links Faster (Tutorial)

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).


 

Intro

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.

slow redirect plugin - slow redirect of my affiliate links

It took more than 10 seconds for the redirecting to work

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.

slow redirect plugin - faster redirect of my affiliate links

After I fixed it the redirecting works quickly

And in this article I will help you to radically improve the time it takes for your affiliate links to work if you use any redirect management plugin or affiliate links management plugin.
 

The secret of making your affiliate links work fast

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.

By the way, if you want to speed up your website, check out this research on how some caching options can help you.

 

Prove the concept before you get rid of your affiliate links management plugin

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.

By the way, if you want a faster hosting, have a look at this research.

 
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.

  1. 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.

    making affiliate links faster  - make a copy of your htaccess
    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.
  2.  

  3. 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:

    slow redirect plugin - adding test redirect to htaccess to test speed

  4. 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.
  5.  

  6. 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.
  7.  

  8. 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.

By the way, if you want to make your website more secure, have a look at this thorough article.

 

Setting up secure and fast redirecting for your affiliate links – Tutorial

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:

  1. 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/

    slow redirect plugin - Add folder for redirect

    Add folder ‘go’ (or you can name it whatever you want)

  2. Block this new folder for web crawlers in your robots.txt (located in your public_html folder) by adding
    User-Agent: *
    Disallow: /go/
    

    slow redirect plugin - add dissallow in robots_txt

    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.

  3. 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.

    slow redirect plugin - uploading files to folder

    The files uploaded to ‘go’ folder

    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.

  4. 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“:
       
      slow redirect plugin - test affiliate link redirect
       
      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:
     
    redirects.txt file sample for redirecting to affiliate links

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>

By the way, I recommend a number of hosts depending on your unique needs and requirements on this page.

 
That’s it! Now your redirects will be handled quickly without using WordPress and your slow affiliate links management plugin.

Conclusion

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.

Subscribe to Free Researches
Get smarter and work on your blog and small business more efficiently

subscribe
BTW, I respect your privacy, and of course I don't send spam, affiliate offers or trade your emails. What I send is information that I consider useful.

Comments

  1. Hi,
    Thanks for the great article.
    Why don’t do the redirects just via the .htaccess file?

    • Hi Daniel,
      Thanks for your question.
      Bare redirect via htaccess file don’t hide your affiliate links, which is not good for SEO (Google does not love a lot affiliate links on your page). And the way described in this article uses a Yoast’s simple script that adds “X-Robots-Tag: noindex, nofollow” to the header of the redirects. This is a safer approach of dealing with affiliate links.

  2. Hi Michael,

    Thanks for this explanation. I actually found the Yoast article before yours, and tested it on my website, but ended up on your website because my redirects are still slow with this script (4 seconds at least).
    But your way of testing 302 before implementing the script is very interesting, because on this test it takes few milliseconds only to load…
    Example with 302 in htaccess : http://beastof.com/tmpredir
    And example with the Yoast script (redirects to the same website) : http://beastof.com/goo/testclo

    It’s totally slow compared to the previous one. Any idea why ? Thanks for your help πŸ™‚

    • Hi Berenice,
      I’ve tested both your links and they seem both to be not slow: https: //www.webpagetest.org/result/170308_XK_AA4/ and https: //www.webpagetest.org/result/170308_GV_APE/.
      I’d assume that during your slow test there could be your hosting server’s temporary overloading or a network increased latency (surely not due to your redirects πŸ™‚ ).

      • Yes, indeed, it seems fixed now oO
        Weird that I tested both links several times in a short time window so I don’t understand how one would be consistently much slower than the other. But anyway, thank you πŸ™‚

        • Hi Berenice,
          A pure redirect uses Apache server functionality, whereas redirect with /goo/ uses php. So, at the time of testing there were probably some serious issues with handling php on your server.
          Anyway, glad to hear it’s all fixed now.

It's important for me to know what you think

*

Show Buttons
Hide Buttons