Link Cloaking Plugin for WordPress
I’ve created a plugin for WordPress that can cloak outgoing links in your posts and/or pages.
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.
- As of version 1.1, static link cloaking.
New! The premium version of this plugin is now available and includes several new features :
- Cloak links in any part of your site, including the comment section and the sidebar.
- Five new cloaking types – for example, you can display the cloaked URL in a frame, or use a special redirect that hides the referrer.
- Improved link management and click statistics.
- Free automatic updates.
- And more. Check out EclipseCloaker.com for complete details.
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
- Download the link-cloaking-plugin.zip file.
- Unzip the file.
- Upload the `link-cloaking-plugin` folder to the `/wp-content/plugins/` directory.
- Activate the plugin through the ‘Plugins’ menu in WordPress.
- (Optional) Go to Options -> Link Cloaking and modify the default settings to your liking.
- Re-save your permalink settings to insert the plugin’s link redirection code to the WordPress .htaccess file :
- WP 2.7 and above : Go to Settings -> Permalinks and click “Save Changes”.
- Older versions of WP : Go to Options -> Permalinks and click “Update Permalinks”.
Download
Version 1.3 : link-cloaking-plugin.zip (9 KB)
Requirements :
- WordPress 2.2 – 2.8.4
mod_rewrite. If “pretty permalinks” work on your blog then you probably have this already.
It does support WP 2.7. If it’s not working, the most common reason is you need to update the permalinks (see the post above).
Curious. Is it possible to automatically cloak links in the RSS feed as well as in a post?
Or, better yet, *not* cloak links in the post, but cloak them in the feed?
Reasoning – I am using some article directory articles in my blog. I can’t cloak those since it is a TOS violation. But, my feed could get scraped, and I’d like *those* links to point back to the actual article on my blog. Or something like that. Plus, although I am leaking some PR in the post itself, I’d rather not leak more of it in the feed.
I’m pretty sure that in the current implementation it also cloaks links in the feed. Your suggestion has been noted.
[...] Link Cloaking [...]
This is a great plugin and going to be real help in a new project of mine, thanks.
I just have a question. For security I have a different wordpress address to my blog address i.e.
WP Address: http://www.domain.com/wp_folder/
Blog Address: http://www.domain.com/
As the functions are using the siteurl to build the redirects my wordpress address appears instead of my blog address for the cloaked links. I’ve tried changing ’site url’ to ‘home’ and adding the wp_folder to htaccess but haven’t had much luck. Any suggestions?
Thanks.
Tricky. The rewrite rules generated by the plugin are not actually fully compatible with WP 2.6, so editing them might be tricky, too.
Anyway, I’ve uploaded a new version that could fix your problem. Maybe. You will need to update permalinks (to regenerate .htaccess) after installing it.
Excellent! That worked a treat, just had to append the worpress folder name to the path in the .htaccess and it worked.
Thanks for going to the trouble of looking at it
[...] if you use a Wordpress Blog there is a good plugin for cloaking affiliate links, called ’Link Cloaking Plugin for Worpress’ (surprisingly!) which you can download for [...]
Hi, I’ve just installed the plugin and the cloaking looks to be working but it’s not redirecting – just goes to a 404. I have updated the permalinks and I’ve also tried altering the directories in the .htaccess to see if it makes a difference but no luck so far, this is what I currently have in the .htaccess file
# Link Cloaker Plugin BEGIN
RewriteEngine On
RewriteRule goto/([^/]*)/([0-9]+)/([0-9]+)/? wp-content/plugins/link-cloaking-plugin/wplc_redirector.php?post_id=$2&link_num=$3&cloaked_url=$0 [L]
RewriteRule goto/([^/]+)[/]? wp-content/plugins/link-cloaking-plugin/wplc_redirector.php?name=$1&cloaked_url=$0 [L]
# Link Cloaker Plugin ENDS
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
The .htaccess looks fine at first glance, but it also appears you don’t have the latest version of the plugin (1.2.6). Download and install it again, then update permalinks, too. The latest version uses slightly different rewrite rules that should be more compatible with some non-standard WP installations.
[...] [...]
What is No Follow cloaked links?
This option inserts the
rel="nofollow"into the cloaked links. Nofollow’ed links are ignored by search engines, which can be sometimes useful for SEO purposes. You might nofollow a link if you don’t want search engines to count it as a “vote” for the linked site.Maybe I missed the whole picture here, but if I write an article in wordpress and I’m linking to an affiliate, I just link whatever text I like with the affiliate url. How does this plugin do anything different than that? I would like to hide the url when I get to my affiliate! Did I miss something? I’m probably too dumb to understand the difference.
When you use a normal link the user can hover the cursor over the link and see that it goes to an affiliate site. With this plugin, the link will look as if it points to another page on your site (e.g. “yoursite.com/goto/1/2″).
However, the user will see the URL of the affiliate site when he actually goes there. If you want to prevent that you’d need to open the link inside a frame, which is currently not possible with this plugin.
Hi
Just installed the plugin and it works great. However, I have an issue. I want the destination url to NOT reveal the affiliate link but just to show the merchant’s url. For example, if I cloaked http://www.clickbank.com/aff?3 to http://www.abc.com/goto/clickbank/, when I click on the cloaked link, it brings me to the merchant’s page with my ugly affiliate link showing on the browser url. This is the part that I’m most worried about in terms of aff hijacking. Is there a way to have the destination url to not show the aff link but just the merchant’s url?
THanks very much
Txn
Not really. Only the merchant him/herself can implement this – they could use a redirect to go to record whatever aff. data they need and then send the visitor to a “clean” URL. It’s not hard to do but many sellers just aren’t that tech savvy/don’t care.
Alternatively, there’s the frame idea I posted about above, but it’s not implemented yet.
[...] Link Cloaking Plugin [...]
Great plugin! Thank you! One future suggestion that would be great is to be able to categorize the statics links (i.e. I’d like to basically reproduce my categories list into the static links so that I can easily find the ones I need.)
Hello again! I just posted yesterday, but I have a question. Is there any way we can edit the affiliate link without having to delete the old one and re-add it?
Sorry, that’s not possible in this version.
I’ve downloaded the plugin and, while it cloaks the affiliate banners, it doesnt cloak the affiliate banner ads.
Can I just confirm that it only cloaks the ads and not the “javascript” ones too?
Cheers
Ignore the above as the use of html has made my post confusing!!!
I’m trying to find out if linkcloak will cloak script language javascipt banner ads, as it doesn’t appear to do so with my site?
Cheers
It doesn’t cloak javascript ads. In fact, I suspect there is no way to cloak script-generated ads efficiently unless you write a custom cloaking script for each ad service.
Having some problems with the pluing in Wordpress 2.7.
When plugin is activated, I find I am unable to upload images, add catergories or tags. Deactivating the pluing allows it though.
This could happen if the plugin outputs an error message when loaded during an AJAX request. I’ll need to know the error message to fix it, but extracting the message from the AJAX stuff can be a bit tricky.
Personally, I’d go with a HTTP sniffer and examine the traffic manually. But that might be overkill in your case, so here’s something simpler to try – check your WordPress directories for
error_logor similarily named files. In many server configurations PHP errors are recorded in these files, so you may find the error message in there. Check the root directory, wp-admin, and the plugin’s directory.i’m getting the same 404 errors with that this guy is, on the latest 2.7.1:
February 20, 2009 at 15:08
Hi, I’ve just installed the plugin and the cloaking looks to be working but it’s not redirecting – just goes to a 404. I have updated the permalinks and I’ve also tried altering the directories in the .htaccess to see if it makes a difference but no luck so far, this is what I currently have in the .htaccess file
—-
i did everything according to your directions. I had this issue before and fixed it but I don’t recall what I did to make it happen.. Can you assist? Thx for this killer plugin.
Can you post the relevant part of the .htaccess here? It would be much easier to figure it out if I knew what the rewrite rules look like for your site. (You can also email it to me at whiteshadow [at] w-shadow [dot] com if you don’t want to disclose this information publicly)
sure, and thx..
# BEGIN WordPress
# Link Cloaker Plugin BEGIN
RewriteEngine On
RewriteRule out/([^/]*)/([0-9]+)/([0-9]+)/? http://example.com/wp-content/plugins/link-cloaking-plugin/wplc_redirector.php?post_id=$2&link_num=$3&cloaked_url=$0 [L]
RewriteRule out/([^/]+)[/]? http://example.com/wp-content/plugins/link-cloaking-plugin/wplc_redirector.php?name=$1&cloaked_url=$0 [L]
# Link Cloaker Plugin ENDS
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
# END WordPress
Hmm, everything looks fine and the URLs are correct, but it still doesn’t work. Let’s try this : replace the plugin’s rules with these :