Join Free
+ Reply to Thread
Results 1 to 7 of 7
  1. #1

    Suggestions for Link Cloaking

    Hi all,

    I am looking for some simple solutions to link cloaking. I would like to create cloaked links on my site that redirects to an external link (e.g. affiliated Prosperent links). Ideally, the cloaked links would look something like this to site visitors:

    Where it says "008247" there would be some number or letter combination that would automatically be created when using an affiliate link in a post.

    I have seen this done on several well-known sites, including RetailMeNot and BradsDeals. Google Webmaster Tools Help offer this as a solution to avoid passing pagerank when they talk about it on their link schemes info page:

    You can prevent PageRank from passing in several ways, such as:

    Adding a rel="nofollow" attribute to the <a> tag
    Redirecting the links to an intermediate page that is blocked from search engines with a robots.txt file
    Basically, my question would be how to do redirect to this "intermediate page" so I can block the external links from Google bot?

    I have read Yoost de Valk's article on how to cloak your affiliate links, but his third step about creating a script in a redirects.txt file confuses me.

    I should also mention, I am using a WP site, but I do not wish to use a plugin.

  2. #2
    Yoost uses some good programming techniques like separating the code from the data by using a text file like a database, but he overcomplicates it quite a bit.

    Here's a really easy method:

    There are actually three methods in that post. The one at the end that uses a php script and .htaccess is the one to look at. It's actually the same as Yoost's method, but simplified.

  3. #3
    This method does look extremely simple, however, I tried to implement it on my site and wasn't successful, so I have some questions that you might be able to answer.

    Here is the redirect script from the article:

    PHP Code:

    = array(
    #8216;affiliatelink1′ =>  ‘’,
    &#8216;affiliatelink2′ =>  ‘’,
    &#8216;affiliatelink3′ =>  ‘’,


        if (
    array_key_exists($_GET[&#8216;id’], $path))
    header(&#8216;Location: ‘ .$path[$_GET[‘id’]]);
    My assumption was that "affiliatelink1" was some combination of letters and/or numbers, which I create, that corresponds to an actual affiliate link "", so that I can redirect it from the actual link shown to users (i.e.".

  4. #4
    Your assumption is correct.
    That code's a mess. I assume it's not like that in your actual php script and it just got messed up posting it here?

    The problem likely lies in the .htaccess file or apache configuration where mod_rewrite or AllowOverride is not enabled.

    When you say not working, what's happening?

    Are there errors on the screen or in the logs?

  5. #5
    Yes it is messed up, let me instead quote it:


    $path = array(
    ‘affiliatelink1′ => ‘’,
    ‘affiliatelink2′ => ‘’,
    ‘affiliatelink3′ => ‘’,


    if (array_key_exists($_GET[‘id’], $path))
    header(‘Location: ‘ .$path[$_GET[‘id’]]);
    When I say it's not working, the link ("" is going to a 404 page.

  6. #6
    Let me instead do an example of what I am doing:

    Where it says 'affiliatelink1' I input '0001', and where it says '' I put the affiliate link, so then the link I post on the site page is "".

  7. #7
    Yes that's how it should work.

    Still those quotes are not valid PHP, but I'm not sure that's a cut and paste thing or what you really have. Check that first. Delete them in the code and replace with regular single quotes, '

    The errors in the apache logs would tell you. And from here, that's what I'd need to help more too.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
coupons | coupons and deals