Demystifying Betting Myths
Statistics are the language of betting; learn to speak fluently, and the market will reveal its secrets.

Experience the future of sports betting education at our new store – visit Soccerwidow's new store!

Management of External & Affiliate Links via Redirection Scripts in WordPress


Hopefully, as your Web site grows and prospers, inevitably, the number of external links will grow too. However, from the very start of your Internet project, it is crucial to be aware that Web pages on third party Web sites have the annoying habit of changing or disappearing.

When visitors to your Web site click on a faulty link a ‘404-error’ page will usually appear informing them that the link is broken. This is not only time-consuming and annoying for your customers, but it could also mean you are missing out on important revenue.

It is not too worrying if the broken link is one that points just to a site where you once found an interesting article and the intention is to share it with your readers. If the site with the great article has removed it or disappeared altogether this is just plain annoying and possibly only your reputation/reliability will suffer in the eyes of your readers. A real problem occurs when recurrent links, such as to your affiliate programmes, fail to work.

Affiliate partners, like any other Internet entity, have from time to time a habit of developing their Web sites and modifying their links. For example, they may change their domain and address or decide to outsource their affiliate programme. As an affiliate partner you will receive notification (hopefully in advance!) advising of the various changes and instructing which links in your site should be changed.

Another reason for needing to change external links may be that you decide to stop working with a particular affiliate partner. In this case, you would have to delete all links to them. However, perhaps you have dozens of articles all featuring links to that particular affiliated company, making it easy to miss one. A solution to this problem might be to redirect the outmoded links to your own homepage. A worse scenario might be that you are required to delete all affiliate links to that specific partner because they have terminated their agreement with you.

Alternatively, you may simply have changed your outlook. In the past, maybe you linked directly to the affiliate partner but now you have written a good and informative review on it for your readers and want them to visit this page first, rather than going straight to the affiliate.

Whatever the reasons for needing to change the link destinations in your blog, if you are not properly managing your links then you will have no option but to painfully go through every published page and change every single link, one by one. This is not only extremely time consuming, but carries no guarantee that you won’t miss amending some links.

We therefore recommend that from your very first day of blogging, you should organise and manage all affiliate and other recurring external links as a redirection. This is done via redirection scripts and if the linked address has to be changed these scripts facilitate the task as only one single record needs to be amended, not hundreds.

How do Redirection Scripts Work?

  1. Create a php Redirection Page for each Link

    Every external link gets its own php page which is uploaded to your server, for example, using the following path:

    www.yourdomain.com/links/nameofthelink.php

    Here’s the code:

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="robots" content="noarchive, noindex, nofollow, noodp, noydir" />
    </head>
    <?php
    /* Redirect browser */
    header("Location: THE ADDRESS TO BE LINKED TO");
    /* Make sure that code below does not get executed when we redirect. */
    die();
    ?>
    <body>
    </body>
    </html>

  2. Linking in the post

    The link in the post is set as usual. However, it is not directly targeting the external Web site, but the specially created php redirection file:

    <a href="http www.yourdomain.com/links/nameofthelink.php" title="nameogthelink" target="_blank" rel=”nofollow”>Nameofthelink</a>

    When readers click on this link, it takes them first to the internally created php file which redirects them promptly to the desired external link. The delay is only a few milliseconds for the reader, but for you, the Web site owner, it could save hundreds of hours’ work in the long run.

    If you later need to change the landing page then only the one php file needs to be amended, not every individual link you have placed on your site.

    You should include the “nofollow” attribute in the link deterring search engines following the link, especially if it is a redirect to an affiliate program.

  3. Robot texts

    It is also advisable to insert the following code in the robots.txt:

    User-agent: *
    Disallow: /links/
    Allow: /

    The reason for this is that some search engines do not like php redirects. To avoid penalties, it is recommended throughout the Net that you should prevent search engine access to your directory “links” via the robots.txt.

Which external links should be redirected?

Abstract conception of network and communicationImage: Leszek Glasner (Shutterstock)

This question is probably the biggest quandary, bigger than the technical solution of the re-directions themselves. It is sometimes quite difficult to decide which links need to be redirected. Affiliate links, there is no question. Any link to an affiliate program should go via redirection.

Linking to sites without having an affiliate programme in place has always been performed on a direct link basis for us so far. However, should we someday decide to write an article about a particular site and wish all of its links to land on this page first, then there will be a huge task ahead of us redirecting perhaps dozens of links in dozens of articles.

Another example is the WPML Multilingual CMS plugin. When we started this Web site, this plugin was free and we therefore just linked to the WordPress.org site where the plugin could be downloaded. Since August last year, this plugin is no longer free and has disappeared from the WordPress.org plugin page. This is a pain as we also applied an affiliate program link to it. The problem this has created is that this WPML link is placed on dozens of pages in various articles and it is causing a headache to locate all of these links in order to correct them.

Once you have set an external link, it can only be changed in the original text. A redirection of external links to anything other than the external destination is not possible.

It is therefore extremely important that you think every time before setting an external link, whether this is a link that which will appear on your blog only once or whether it is a recurring link. If it is a single link then any change required will be only once. However, if the link is recurring then you should always do it via the above described php script redirection.

Check, check, and check again!

Unfortunately, readers hardly ever report faulty and broken links to the Webmaster. Indeed, Soccerwidow have never received a single email notifying us of a broken link (despite more than 100,000 page views to date and thousands of clicks on links!).

As a serious blogger, you will need to schedule routine link checking in your calendar, ensuring that each link to an external source is still in working order. Your own internal ‘404 errors’ can be located with a script. But this topic is the subject of a future article…


Last Update: 23 May 2012

Categories:Website Monetising Wordpress Tips



No comments yet.

Leave a Reply / Comment

Notify me of followup comments via e-mail. You can also subscribe without commenting.