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.
- Works with plugin-created links.
- 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 Settings -> 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 : go to Settings -> Permalinks and click “Save Changes”.
Download
Version 1.8.2 : link-cloaking-plugin.zip (10 KB)
Requirements :
- WordPress 2.8 – 3.0.1
mod_rewrite. If “pretty permalinks” work on your blog then you probably have this already.
I keep getting a 404 page. This is the page – http://www.smartgeezer.co.uk/2008/rip-curl-hells-bells-reversible-beanie-hat/ – permalinks has been updated, htaccess updated, I’m pretty sure I set it up right.
Also, the link doesn’t open in a new window, even if I add the relevant code to Line 90.
Any ideas?
OK, I’ve fixed the opening in a new window (had to remove nofollow in the Link Cloaking options) but not the actual link. It just tries to open the link – http://www.smartgeezer.co.uk/goto/link/68/1 – rather than converting it to the proper cloaked link.
I’ve looked at your site and my guess is that the .htaccess rules aren’t working. Can you post the relevant part of your .htaccess here? Anything between “# Link Cloaker Plugin BEGIN” and “# Link Cloaker Plugin ENDS”.
Alternatively, email it to me at whiteshadow {at} w-shadow (dott) com
# 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
tx
Interesting. The .htaccess looks fine. What’s more, the redirector script itself works OK, as can be verified by visiting this link :
http://www.smartgeezer.co.uk/wp-content/plugins/link-cloaking-plugin/wplc_redirector.php?post_id=68&link_num=3
Maybe the rewriting rules don’t get executed. Is that part of .htaccess before or after lines that look like this? –
RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L]The whole .htaccess which sits in the root:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^smartgeezer.co.uk [NC]
RewriteRule ^(.*)$ http://www.smartgeezer.co.uk/$1 [L,R=301]
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
# 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
You beauty! You’re right, I moved the Link Cloaker stuff to the top and now it works.
Thanks a lot for your help and for this plugin.
Good
I’ve spend some time reading this article and I have to congratulate you for creating a WP plugin that’s doing this.
I’ve wrote a small article dedicated to easy cloaking methods using JavaScript and PHP for others that are not so good with programming
Link cloaking step by step guide
Fantastic plugin mate,
Thank you for releasing it!!!
Have a Great 2008
Hi, i wanted to use your plugin also. i uploaded it to the plugin directory, then, i activated it and updated the permalinks! but it doesn’t write any code in the htaccess file, so it doesn’t work!
can you help me? any idea?
do i maybe have to change something in the server admin menü?
I wouldn’t know about your server admin menus, but maybe you could try adding the code manually and see if it works? In most cases adding this to .htaccess should work :
The above code should probably be placed *above* any code that is already there.
doesn’t work
my version of wordpress is 2.3.1 as i think.
hmm… any other idea?
my htaccess now looks like this:
# .htaccess file create by vsa 3.2.9 webserver_rev 2.3
AuthType Basic
AuthName “Members Only”
AuthUserFile /vol2/home/k102184web/.htusers
AuthGroupFile /vol2/home/k102184web/.htgroups
# Link Cloaker Plugin BEGIN
RewriteRule more/([^/]*)/([0-9]+)/([0-9]+)/? wp-content/plugins/link-cloaking-plugin/wplc_redirector.php?post_id=$2&link_num=$3&cloaked_url=$0 [L]
RewriteRule more/([^/]+)[/]? wp-content/plugins/link-cloaking-plugin/wplc_redirector.php?name=$1&cloaked_url=$0 [L]
# Link Cloaker Plugin ENDS
# BEGIN WordPress
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
# END WordPress
Eh, I forgot to mention to put your own option instead of “more” there; I think it’s “goto” by default.
Other than that, I’d check if the scripts are there (yourdomain.com/wp-content/plugins/link-cloaking-plugin/) and if the redirector is actually getting called (check HTTP headers or something, if you know how).
I changed it to goto, but nothing happened! hmm… how can i check, if the redirector is called? ^^ i’m not such a pro
Well, a simple way would be to open wplc_redirector.php in a text editor and put something – anything – before the first “<?” string. Then click a cloaked link and see if the text you placed there shows up.
i put “roflmao
” before the first <?php and it appeard in the left corner of the whole website including the admin menu
I find that unlikely/strange. wplc_redirector.php should only be called when you click a cloaked link. Maybe you modified wplc_link_cloaking_plugin.php?
oh
you’re right
i modified the wrong file! ;D;D
but if i put it into the redirector.php file, nothing happens if i click on a cloaked link… he always says, that this page doenst exist oO
I think the .htaccess is to blame, because it doesn’t call the redirector… and that’s all I can say
If I was in a situation like this I would try to mess around with the .htaccess file, trying various things, to see why it doesn’t work. However, I don’t have a tutorial for that…
I met same problem with Christoph…:-0, hope I can find the solution soon….
a BIG fat thanks for this plug!!
Was going nuts because I had only 404s in the beginning, but found the solution in the comments here – maybe you can add it to the readme that the code in .htaccess has to be at the top – by default it is added in between and wordpress (2.3.2 on my site) adds the WP defaults to the end of the file again… so editing .htaccess manually seems to be a must.
Now just have to manually redirect the sidebar links.
All best and again THANKS for this one!
Good idea, I’ll add it to the readme.
pls try to find a solution for my problem =\
i need your plugin very much ^^
Eh, I don’t know. Maybe you need to put the plugin code before the authentication codes? Or something?… No new ideas :/
I put the plugin code on the top of the .htaccess, yeah,it works!! Thanks
I have seen this is a great one for a nice Wp plugins
Thank You..
[...] einfachste Methode ist meiner Meinung nach: Link Cloaking Plugin von W-Shadow. Einfach [...]
Seems still not working with wordpress version 2.3.3 any advice?..