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.
I ended up using a different theme. I just wanted to give you heads up and I was curious what you think might be causing this. I think using these AJAXy themes could hurt my SEO ratings anyways, that’s why I switched themes.
Ahha, I actually didn’t get anywhere with that theme. And I agree that AJAX is probably bad for SEO.
Great help, thanks.
Plugin tested with WP 2.7 and it works though you will need to update the permanent link tab once you have upgraded to 2.7.
The plugin looks great, but I have slightly different requirements. Can you point me to a plugin that would actually CHANGE the outgoing links (not just cloak them for the user) to links pointing to my own domain?
So basically I’m blogging using an RSS feed and the posts contain lots of outgoing links. I’d like these links to be changed to http://www.mydomain.com/link-1234.html or something which would then re-direct users to the actual page. I’m guessing this would have some SEO benefit by not having too many outgoing links in the posts.
Is my logic here wrong, or is there a plugin that does this?
Thanks!
I think your logic is a bit confused, yes.
You want a plugin that will rewrite all external links to look like internal ones. However, when the user clicks on such link, they should be redirected to the actual external page. As I see it, this is exactly what Link Cloaker does (except the URLs don’t end in .html).
Or did you perhaps mean that you want a plugin that would create actual HTML pages that contain nothing but a meta redirect/Javascript redirect? IMHO that would have no SEO benefit and would look weird from the user’s perspective.
If your main concern is SEO and having too many external links, just check “Nofollow cloaked links” in the plugin’s configuration. This way the cloaked links won’t “count” from the search engine’s perspective.
Plugin tested with WP 2.7 and works just fine.
Still there is a problem with the images. Let me explain.
I use two plugins for them.
jQuery-Lightbox(http://www.pedrolamas.com/projectos/jquery-lightbox) and Add Lightbox (http://mdkart.fr/blog/plugin-add-lightbox-pour-wordpress/)
The Add Lightbox plugin automatically adds the rel=”lightbox[ID_OF_THE_POST]” to images linked in a post using the code href=(’|\”)([^>]*).(bmp|gif|jpeg|jpg|png)(’|\”)(.*?)>(.*?)/i. BUT it cannot do that since they have already being cloaked.
Any way of getting the lot working in harmony/
Thanx in advance. Great work
Your cloaker works fine for affiliate links in the posts. However, I noticed that the affiliate links are NOT cloaked in the side widgets.
How can I do this?
Thank you,
John
@ uhubuhu : That’s a bit hard to fix properly in the current release. As a workaround, giving the cloaking hook a later priority might help. To do that, open wplc_link_cloaking_plugin.php and on line 38 change the 2 to 20. The new line should look like this :
@ John : Currently this plugin can’t automatically cloak links in widgets. However, you could create “static” cloaked links (Tools -> Cloaker Links) and use the cloaked URLs in the widgets.
This plug in looks great! Does it also have click tracking so you can track how many people are clicking your affiliate links?
@ Todd : Yes, but only for “static” links, i.e. automatically cloaked links aren’t tracked.
Hey. I’m having a bit of a problem with the plugin on Wordpress 2.7. I’m trying to cloak my links in the side bar. I’ve used the static cloaking tool and have manually copied and pasted the links into the blogroll, but I get a 404 error when clicking on the links. Any ideas?
Most likely it’s something to do with .htaccess rules. Do automatically cloaked links work (in posts)? If not, update your permalinks and ensure the cloaking-related rules are near the top of the .htaccess.
@White Shadow – Thanks! Totally works. And also, thanks for the quick reply.
[...] Link Cloaking: Automatically cloaks outgoing links in your posts and pages. You can also add static cloaked links manually. [...]
works like a champ. I have 2.7 and it worked without any refreshing. Thank you for this simple yet invaluable plugin.
Hi,
I’m having trouble with the Link Cloaking plugin. I have tried every way but I only got 404 pages from the links.
I have wordpress 2.7, PHP Version 5.2.2 and the following plugins installed:
All in One SEO Pack
Easy AdSenser
Google Analytics for WordPress
Google XML Sitemaps
My Category Order
Sociable
WassUp
WordPress Database Backup
WP-PostViews
My .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]
Would be very grateful if I could get some expert help.
Sincerely
// Daniel
Looks like your wp-content folder is in a different location than the plugin expects (this is probably a bug). For now, you could try changing two lines in the .htaccess like this :
I’m not sure if the forward slash is required before “wordpress”, so try removing it if still doesn’t work.
Hi White Shadow,
Thank you for your fast response, really good support =)
Now I saw that there were two .htaccess files on my server. One in the root and one in the /wordpress folder. When I updated the permalinks in wordpress admin it was the only the .htaccess in the root that was updated with the # Link Cloaker code.
So I copied the code and paste it into the .htaccess file in the /wordpress folder and now it works perfectly. I wonder how it is that I have two .htaccess files?
Best // Daniel
No idea about the two files; but it’s good that you got it working
Yes, thank you again. What a wonderful plugin.
How can you tell if your link is cloaked?
Thanks
Darrel
Hover your cursor over the link and look at the status bar. If the link is cloaked, you will see an URL that points to the current site. However, the link will actually lead to a different site when clicked.
[...] Link Cloaking PluginExcellent plugin to cloak outgoing links in your posts, pages, sidebar, etc… (see my woothemes goto-links in the sidebar) [...]
Love the plugin but I’m having a pretty serious problem, I’m #1 on google for a particular search phrase but when you click on any of the links on this site or any others I have that are using this plugin you go nowhere and you get 404 errors. However it works perfectly fine if your using Mozilla Firefox and click any of the links they are operational and take you exactly where they should. Internet explorer on the other hand, has none of them working, bringing up 404 errors. How in the world does this work only using firefox and on none of the other browsers?? How can I fix this so it works on every one of them????
Thanks in advance for your help,
Dave
According to my own tests, the cloaked links work in IE, Chrome, Opera and Firefox. As far as I know, there is no credible reason why they wouldn’t work in any particular browser – with the possible exception of some kind of bug/malware in the browser itself.
Thanks for your quick response on this. I’m still trying to figure out how I got this to work for firefox but not IE or the others it works with. I’m thinking that I may have coded it wrong in the html for it to work in IE.
Can you give me an example of how it should look like in raw html code, so I can be sure I did it right and used proper coding??
Let’s say my site is pooltables.com and I want to hyperlink link some text, like billiard balls for sale, and cloak the link that’s going to another site within that linked text. Would you show me what that should like in raw html form please or rather how it should be written?
Thanks again for your help with this!
Dave
* With dynamic cloaking :
* With static cloaking :
Go to Tools -> Cloaked Links and create a new cloaked link. Then just use the cloaked URL that will be provided by the plugin in place of the original URL. The cloaked URL will look something like this : http://yourdomain.com/goto/yourtext/ , so you would use that address in your posts.
Thanks so much for your help with this! Have a great weekend!
Hey you Plugin not support wordpress 2.7