Link Cloaking Plugin for WordPress

This is a plugin for WordPress that can automatically cloak outgoing links in your posts and/or pages.

Download plugin
(Note: May not be compatible with the latest version of Eclipse Link Cloaker.)

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.
  • 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.
  • If desired, you can also add your own cloaked links manually.

Examples

Lets say you’ve got a link you want to be cloaked.

<a href="http://example.com/?affiliate=me">Cloak Me</a>

Once you install the plugin, it will automatically, without requiring any configuration, turn it into a cloaked link when it’s displayed to a visitor:

<a href="http://yoursite.com/goto/Cloak_Me/12/34">Cloak Me</a>

Here’s a live example: Cloak Me

As an alternative to the fully automatic cloaking, you can switch the plugin to “selective cloaking” and tag the links you want to cloak manually:

<a href="http://example.com/?affiliate=me">Cloak Me<!--cloak--></a>

Note: The plugin does not actually edit your posts or permanently modify your links. Instead, it switches them on-the-fly whenever someone views them on your site. When editing a post in the admin panel, you will see the original, uncloaked link.

Download

Version 1.8.4 : link-cloaking-plugin.zip (16 KB)

Requirements :

  • WordPress 2.8 – 3.3
  • mod_rewrite. If “pretty permalinks” work on your blog then you probably have this already.

(Note: May not be compatible with the latest version of Eclipse Link Cloaker.)

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 Settings -> Link Cloaking and modify the default settings to your liking.

FAQ

Why are some of my links not getting cloaked?

The most common possibilities are:

  • Links in the sidebar, header, comment area and so on can’t be cloaked by the free version of the plugin. It only works on links in page/post body. Upgrade to the premium version to cloak links anywhere on the page.
  • Links added using other plugins, theme features or custom fields are also supported only in the premium version.
  • JavaScript links, as well as Flash and context-sensitive ads are not supported by any version of this plugin.

Why are none of my links getting cloaked?

  • If using “Seletive cloaking”, make sure you have actually marked some links with the <!--cloak--> tag.
  • Double-check that the links in question aren’t added or modified by plugins, the theme, or custom fields.
  • Contact me. You might have found a bug.

The exception list doesn’t seem to work. What could be the problem?

Make sure to enter only domain names in the “Exceptions” box. For example, given a link like “http://example.com/directory/page.html”, the domain name is the “example.com” part. So to prevent the plugin from cloaking that link, add “example.com” (sans quotes) to the “Exceptions” box. Entering the full URL or “http://example.com/” will not work.

Additionally, if some of your links point to example.com and some to www.example.com, you will need to add both of those to the exceptions.

Why do some cloaked links redirect me back to my homepage?

Most likely, your post(s) contain links created or modified by other plugins, the theme, or custom fields. Either remove those links, or upgrade to the premium version.

Why do some cloaked links redirect me back to my homepage?

See the previous question.

Why do cloaked links display a “Not Found” error?

  • Make sure you’re using pretty permalinks.
  • Your .htaccess might be out of date. To update it, go to Settings -> Permalinks and click “Save Changes”.
  • Your hosting company may be blocking browser access to PHP files in the /wp-content/plugins/ directory, usually as a security measure. The free version of the plugin is not compatible with these hosts. Consider using the premium version instead.

I have a question not addressed in this FAQ. What should I do?

Either leave a comment below, or email me directly. My email address can be found on the contact page.

Related posts :

802 Responses to “Link Cloaking Plugin for WordPress”

  1. White Shadow says:

    @Wally – The wording on the options page has been changed in newer WordPress versions and it doesn’t say “Update Permalinks” anymore; anyway, saving the settings should be enough.

    Just to clear this one up, the .htaccess file needs to be in the directory that the blog is installed in (or your post permalinks probably wouldn’t work).

    I would guess that the plugin-related .htaccess rules are incorrect in your case, most likely either in the prefix or path; I can’t provide any more details without knowing your directory structure and plugin configuration.

  2. Wally says:

    WS,

    My blog path is just domain.com/blog/. Then it is the normal WP setup. The path to the linkcloaker plugin is \blog\wp-content\plugins\link-cloaking-plugin and I have it set to the default settings for now.

    There wasn’t a .htaccess file in the /blog directory so I just created one with the 3 lines mentioned below in a post between the # START WordPress and # END WordPress. BUT… after trying to get the plugin to work the .htaccess file disappears. I guess WP must be deleting it.

    So, maybe there is another conflict and this won’t work on my blog.

    Thanks anyway.

    Wally

  3. White Shadow says:

    @Wally – Hmm, let me guess – you’re using the basic “?p=xyz” permalinks for your posts, right? In that case WP doesn’t need the .htaccess file and might be deleting it when you update permalink options (just a guess, I have never seen WP actually do that).

    But still, if you create the file manually and put the right lines in it the plugin should work. The challenge might be getting the rules right when doing it by hand.

    By the way, have you tested if you can access domain.com/blog/wp-content/plugins/link-cloaking-plugin/wplc_redirector.php in your browser? If the plugin is correctly installed in the default location that file should redirect to your homepage (not 404).

  4. Wally says:

    WS,

    No I use the custom permalink: /index.php/%year%/%monthnum%/%postname%.html

    When I try to go to the file domain.com/blog/wp-content/plugins/link-cloaking-plugin/wplc_redirector.php, I just get “Index of /blog/wp-content/plugins/link-cloaking-plugin”. It doesn’t list any files but all three php files are there.

    Wally

  5. White Shadow says:

    @Wally – AFAIK permalinks beginning with index.php still don’t use .htaccess/mod_rewrite.

    Ahhh, it’s already past midnight in this timezone and I can’t think of anything else useful 😛

    BTW : There is a way to tell if the plugin actually gets executed when a cloaked link is clicked – it generates a HTTP 301 response and adds a “X-Redirect-Src” field to the header…

  6. Wally says:

    @White Shadow – I don’t see any extra text in my 404 page when the link doesn’t work but I use a custom 404 page.

    I notice my SocioFluid plugin doesn’t work when the link cloaker is turned on. I guess I’ll just leave it alone for now since there seems to be several confilicts or problems.

    Thanks again.

    Wally

  7. White Shadow says:

    @Wally – Web browsers don’t normally show HTTP headers anyway. You’d need a special program or a FF extension to see them…

  8. Waldo says:

    Hi,
    Thank you for the great plugin. I got a question though.

    How to make the link to “link cloak” under manage menu hidden from user other than admin?

    In wordpress under the manage menu, all links from other plugin are hidden except link cloak when I log in as a normal user.

    Thank you.

  9. White Shadow says:

    @Waldo – Okay, I’ve change it so that only users who can access Manage -> Links can get to Manage -> Cloaked Links as well. You will need to download the plugin again.

  10. Waldo says:

    @White Shadow – Hi, thanks for the quick reply.
    It works like charm.

  11. […] Thanks, I found this plugin for wordpress that looks promising: (hope this type of link is ok) ø Link Cloaking Plugin for WordPress | W-Shadow.com ø […]

  12. dinhnq says:

    Hi White Shadow,

    I have install plugin into my website. Unfortunately, my webhosting regularly change my .htaccess file so cloaking links send people to 404 error file.

    How can i configure plugin so whenever the .htaccess change, the plugin is just inactive ?

    Thanks for great plugin.

    dinhnq

  13. White Shadow says:

    @dinhnq – I could modify the plugin to check .htaccess before cloaking the links, but doing it on every pageload would hurt the blog’s performance. Maybe if it checked every 1000 requests or so?….

  14. […] Link Cloaking There is a free WP plugin which you can get here: Link Cloaking Plugin for WordPress | W-Shadow.com I can’t vouch for it in any way as I use a different, more comprehensive (paid) plugin, but it […]

  15. Rip says:

    Hi! I installed this plugin and it seemed to be working, at least on links that didn’t have subid’s appended to the end of affiliate links.

    So I deactivated it, and reactivated to see if I could get it to work with affiliate links, but then it just shut down the whole site and all pages would just go straight to the home page.

    Any idea why it would do that? I had to remove the code that it added to .htaccess to get the site working again. And now I can’t put it back because the site messes up again. (Hope that wasn’t too vague…)

  16. White Shadow says:

    @Rip – The plugin redirects to the homepage when it can’t find the original URL of a cloaked link. This is most often caused by a conflict with another plugin. Specifically, plugins that add new links to posts can cause this issue.

  17. dinhnq says:

    @White Shadow

    Thanks, White.

    I have another question. If I copy post including my cloaked links to a forum e.g. http://abcde.com/goto/Here_to_go/257/10.
    when a click on forum links happen, does this count for my website http://abcde.com/ or forum website.
    i thought it would count for my website because the cloaked links need to be decoded into original affiliate links via my webhost. Is it true?
    If yes, can the affiliate agency track down the original of the click. Some programms are very strick to the registered website, some are not.

    Regards

  18. White Shadow says:

    @dinhnq – I’m not sure what your definition of “count” is in this context, so I’ll make a wild guess you mean to ask can the affiliate company find out that the visitor came from a forum.

    The way they (the company) might be able to do this is by checking the referer – a particular piece of info that is sent along with each request by most browsers. Would the referer field show the forum or your site? The answer is I’m not sure. I ran a few quick tests and it appears that it will show the forum, but I can’t guarantee that is correct for cross-domain redirects (as in your case). Also, the behaviour might be different between various browsers.

    Overall, I think there is a non-zero chance they would be able to find out.

  19. Ludovic says:

    I try to cloak all my download links on my membership website, but when ever i click on it to download an ebook or a file in general, it just gives me an error message. Can you cloak links of download link address. Like for ex: http://www.domain.com/lol.pdf and whenever it gets cloaked, and i click on that link its givs me an error message, back to 404 error page.

  20. Ludovic says:

    hi, i have a membership site, where iw ant to cloack all the download urls. I activated your cloack plugin, and it worked cloacking all the links, then later i notice when i click on a download link like http://www.domain.com/link-plugin.exe thats cloakced, it will bring up a 404.error. How can i fix this? I also, notice the rewrite rule disappear in m7y htcaccess, whenever i update permalinks

Leave a Reply