Link Cloaking Plugin for WordPress

I’ve created a plugin for WordPress that can cloak outgoing links in your posts and/or pages (note : if you’d rather have a more general link cloaking tool, take a look at Link Manager).

Features

  • Choose what to cloak - all links, only the links you specify or no links at all.
  • Choose where to cloak - posts, pages or both.
  • Configure the URL - you can set the “prefix” part of the URL (see examples below).
  • Exception list - links pointing to domains in this list will not be cloaked. For example, this is useful if you have chosen to cloak all links but don’t want to cloak the links to your own domains.
  • Compatible with all browsers - the link cloaker plugin doesn’t use JavaScript so it will work even for visitors that have disabled JS.
  • “Smart” cloaking - relative, ambiguous or malformed URLs will not be cloaked. Better safe than sorry.
  • Update : version 1.1 available - now with static link cloaking!

Examples
Here’s a link explicitly tagged for cloaking -
<a href="http://evil-guide.tripod.com/"><!--cloak-->A Cloaked Link</a>
And here’s what it looks like in the post - A Cloaked Link
If you have configured the plugin to cloak all links (the default) you don’t need the <!–cloak–> tag inside your links.

Installation

  1. Download the link-cloaking-plugin.zip file.
  2. Unzip the file.
  3. Upload the `link-cloaking-plugin` folder to the `/wp-content/plugins/` directory.
  4. Activate the plugin through the ‘Plugins’ menu in WordPress.
  5. (Optional) Go to Options -> Link Cloaking and modify the default settings to your liking.
  6. Go to Options -> Permalinks and click “Update Permalinks”. This ensures the plugin’s link redirection code is added to WordPress .htaccess file.

Download
Version 1.2.2 : link-cloaking-plugin.zip (9 KB)
Tested on WP 2.2 - 2.3.1 (more or less).

Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • del.icio.us
  • Reddit
  • StumbleUpon
  • NewsVine
  • Technorati
  • PlugIM
Related posts:

131 Responses to “Link Cloaking Plugin for WordPress”

Pages: [5] 4 3 2 1 » Show All

  1. 131
    Barbara Ling | How to easily cloak your Clickbank and other affiliate links for free Says:

    [...] A Cloaked Link [...]

  2. 130
    Bert Says:

    I sent you an email with the details of the issue. Once we figure out what happen we can post the answer here for the benefit of all endusers. Thanks again!

  3. 129
    White Shadow Says:

    Hey Bert, thanks for the donation :)

    As far as I know, FF shows this error when a script redirects to itself several times, like in a loop. That should never happen with this plugin, but there’s always a possibility of a stealthy bug. Can you give me an example link that has this problem (so that I can investigate)?

  4. 128
    Bert Says:

    Want to say thanks again for the plugin, but nothing says thanks better than a donation. :)

  5. 127
    Bert Says:

    Hello,

    The start out working great then the redirects started to fail. Here is the error in Firefox.

    The page isn’t redirecting properly
    Firefox has detected that the server is redirecting the request for this address in a way that will never complete.
    * This problem can sometimes be caused by disabling or refusing to accept
    cookies.

    Any ideas of what it could be? Thank you for the your time,
    Bert

    Firefox has detected that the server is redirecting the request for this address in a way that will never complete.

    * This problem can sometimes be caused by disabling or refusing to accept
    cookies.

  6. 126
    Daid Says:

    Thanks for your reply, i know some where google don’t like website with a lot of affiliate links : )

  7. 125
    White Shadow Says:

    If you don’t disallow the links and don’t use the nofollow attribute on them, they (the links) will pass the mystical “link power”, or whatever they call it. That is, your links will (slightly) help the target website to rank better.

    Whether this is good or bad for your own website is highly controversial, and I’m not expert enough to comment on that.

  8. 124
    Daid Says:

    If your link prefix is “goto”, you should add

    User-agent: *
    Disallow: /goto/

    In general, the form is “Disallow: /link_prefix_here/”

    Thanks for your last reply,do i had to add Disallow: /goto/ ?
    If i don’t add Disallow: /goto/ ?
    What may happen ?

  9. 123
    Make Money Says:

    First of all I want to say great plug in. At first I had the 404. It was simply fixed by moving the lines in the .httacces file to the top of the file … works like a charm now

    # Link Cloaker Plugin BEGIN

    RewriteEngine On
    RewriteRule make_money/([^/]*)/([0-9]+)/([0-9]+)/? wp-content/plugins/link-cloaking-plugin/wplc_redirector.php?post_id=$2&link_num=$3&cloaked_url=$0 [L]
    RewriteRule make_money/([^/]+)[/]? wp-content/plugins/link-cloaking-plugin/wplc_redirector.php?name=$1&cloaked_url=$0 [L]

    # Link Cloaker Plugin ENDS

  10. 122
    White Shadow Says:

    Thanks :)

  11. 121
    Robert Jan Says:

    This must be in my top 3 of coolest and more or less ‘hidden’ plug-ins out there. After following the instructions of updating the Permalinks (just save settings in 2.5) and moving the code to the top of the .htaccess it worked like a charm.

    I just had to dedicate an article to you. Thanks, great job!

  12. 120
    Verberg(cloak) je (affiliate)links! | Robert's Gratis Marketing Programma's Says:

    [...] geen enkele credit naar mij, alle kudos gaan naar Janis Elsts voor het ontwikkelen van deze geli(n)kte Wordpress [...]

  13. 119
    White Shadow Says:

    If your link prefix is “goto”, you should add

    User-agent: *
    Disallow: /goto/

    In general, the form is “Disallow: /link_prefix_here/”

  14. 118
    David Says:

    What should i add with robots.txt prevent the search engines from spidering those links
    block them in robots.txt with:

    User-agent: *
    Disallow: ?????

  15. 117
    White Shadow Says:

    Probably there is a way, but I’m currently not inclined to seek it out.

  16. 116
    Spitkicker Says:

    Any way to make it work with the alinks plugin? It cloaks all the links created by alinks, but often if a post got 2,3 identical links only the first one works and rest kicks you back to the root of the site.

  17. 115
    White Shadow Says:

    Yes, the plugin can do that. It can add the rel=”nofollow” attribute to cloaked links, which will prevent them from passing PR. You can enable this feature by going to Options -> Link Cloaking and checking “Nofollow cloaked links”.

    You could also do this by blocking the “link prefix” in robots.txt. By default the prefix is “goto”; it can be configured in the page mentioned above. This is basically the same thing the forum post suggests.

  18. 114
    Bert Says:

    Hello I found your plugin page on the GFY board, the thread start with this post below. Does your plugin hide affiliate links from search engines and prevent the leaking of pagerank like this script below?

    ____________________________________________
    Tip: Affiliate link redirects - Earn more money

    It’s friday and im in a good mood so thought i’d share this little tip with for any blog owners/site owners that have a lot of affiliate links on their pages.

    If you aren’t already redirecting them, well you should be and here’s how:

    Create a PHP file with the following code and your desired affiliate code/text.

    PHP Code:

    ——————————————————————————–

    http://www.realitykings.com/main.htm?id=fapgallery&p=clean‘,
    ‘college-fuckfest’ => ‘http://signupsb.triplexcash.com/cgi/click?account=560307&site=2&program=2′
    );

    if (array_key_exists($_GET['id'], $path))
    header(’Location: ‘ . $path[$_GET['id']]);

    ?>

    ——————————————————————————–

    Save it as link.php

    Then in your .htaccess file (create one if you dont have one) add:

    Code:

    ——————————————————————————–
    RewriteEngine On
    RewriteRule ^link/([/_0-9a-zA-Z-]+)$ link.php?id=$1
    ——————————————————————————–

    Now in this example i used a realitykings.com affiliate link with the anchor text reality kings.

    To include that link on my pages i would just add a link to:

    http://www.domain.com/link/reality-kings

    When clicked that will redirect to the sponsor link :)

    Remember to block the /link folder in your robots.txt file

    Benefits of this technique:

    1. SEO benefits - google isnt fond of too many affiliate codes on landing pages and it also helps prevent bleeding or diluting of your pagerank score.

    2. Prevent any pc tools or other malware stripping out or replacing your affiliate code.

    3. Earn more money!
    for example today’s nastydollars bonus day all i did was alter a few URL’s in the link.php file and now all my inthevip/vipcrew/ links all go through the reality kings tours.

    Tomorrow i can just re-edit that file rather than the 100’s of hard coded links on my sites.
    ___________________________________________________________

  19. 113
    White Shadow Says:

    It is. The “manual work” refers setting up each cloaked link separately :P

    Edit: Okay, let me expand on that. You can go to Manage -> Cloaked Links and add any referral links that you want cloaked. Then you can get the cloaked URL for any of those by clicking the appropriate “show cloaked url” link on that page. Finally, you need to modify your image ads to use the cloaked URLs instead of the original referral links.

  20. 112
    xytheme Says:

    Well, I thought static cloaking is already in this plugin as per your post said? :P

    Thank, nevertheless it is still a great plugin.

  21. 111
    White Shadow Says:

    I’m going to assume you mean they are not in your posts. In that case, you could use static cloaking for them. But yes, it involves some manual work.

  22. 110
    xytheme Says:

    I got some 125×125 ads on my blog, when you hover on them, you will see the url. So, I want to cloak those links, is that possible?

    If not then I would have to create individual files and redirect the link manually.

  23. 109
    White Shadow Says:

    If the image ad is simply a normal linked image in a post or page, then yes, the plugin should be able to cloak it automatically.

    If the ad is something complex, like Flash, JavaScript or an IFrame, or if it is located somewhere else - e.g. in the sidebar - then the plugin won’t cloak it.

  24. 108
    xytheme Says:

    Hey, great plugin you got here.
    I’ve been searching for this like forever.
    Installed and works like a charm.

    One question though, can it parse or cloak the affiliate url on referral image ads?

    If so, can you explain how to do this?

    Thanks.

  25. 107
    Tim Says:

    Thanks for this plugin!!

  26. 106
    Ash Says:

    Thanks, i update the permalinks and its working again.

    Many thanks

  27. 105
    White Shadow Says:

    It works on the WP 2.5 blog that I tested it with, but you might need to update permalinks again.

  28. 104
    Ash Says:

    Does the plugin work with 2.5?

    I had it running on a blog using 2.3.3 but since upgrading its no longer working..

  29. 103
    Spitkicker Says:

    Woks like a charm! Thanks a milion!

  30. 102
    White Shadow Says:

    Comment out this line:

    wp_print_scripts( array( 'prototype' ) );

    in wplc_link_cloaking_plugin.php. It’s around line 148.

    There’s other stuff that could/should be removed as well, but the above line is the only one you need to remove if you just want to prevent the plugin from adding prototype.js inside the <head> tags.

    I hope that makes sense :P

Pages: [5] 4 3 2 1 » Show All

Leave a Reply