How to set up WP Robot Link Cloaking

Since the latest update to 2.0 WP Robot has an option to automatically cloak affiliate links in your blog posts. For this option to work it is not enough to enable it in the WP Robot admin screen, you will also need to edit your blog’s .htaccess file so it contains the necessary redirecting rules for your links. This post explains how you do that.

Important: If you enable link cloaking without editing the .htaccess file none of your affiliate links will work!

Please note you will need a little knowledge of how to modify and upload files on your webserver via FTP to make this work, which is why I only recommend using cloaking for advanced users!

Ok, that said, lets get started:

1. Enable link cloaking in the options.

This one is easy:  Go to your WP Robot options page, check “Cloak Affiliate Links” and save the options.


Links to Amazon, Ebay (except in RSS feeds) and Clickbank should now look something like this on your blog: Those links will not work yet though!

2. Insert Code into the .htaccess file

WordPress can insert the necessary code into the .htaccess file itself as long as it is writeable (which it should be if you already set up permalink rules for your blog – which you should do!). To update the file go to “Settings” > “Permalinks” in your WordPress admin area and just click on “Save Settings” (you don’t have to change anything on the page).

If it worked you will see this message and can continue with step 3:


If it didn’t work it is probably because your .htaccess file is not writeable. In that case you will also be told so by WordPress on the “Permalinks” page. To fix that you can either set permission to make the .htaccess file writeable or use your FTP program to update the file yourself.

If you want to insert the code yourself, this is the full code that has to be on top of the .htaccess file:

# WP Robot Link Cloaking START
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^go/([^/]*)/([0-9]+)/([0-9]+)/?$$2&link_num=$3&cloaked_url=$0 [L]
RewriteRule ^go/([^/]+)[/]?$$1&cloaked_url=$0 [L]
# WP Robot Link Cloaking END

Be sure to replace the YOURDOMAIN part with your actual domain name!

3. Move the WP Robot link cloaking rules to the top of the .htaccess file.

WordPress can automatically insert the necessary redirection rules but unfortunatelly it can not automatically move them to the top of the .htaccess file – and that is where they need to be! So check your links now and if they do not work yet you will have to edit your .htaccess file and move the rules to the top. To do that follow the following steps:

  • Download the .htaccess file to your computer with a FTP program. You can find the .htaccess file in your blogs main directory. See this link for more details on how to find your .htaccess file if necessary.
  • Open the file with any text editor of your choice.
  • Look for the lines that read “# WP Robot Link Cloaking START” and “# WP Robot Link Cloaking END” inside the file. Move those two lines with everything between them to the very top of the file. (If you can’t find the lines just insert the code you find in section 2 above into the file at the top.)
  • Save your changes and upload the file to your weblog again via FTP. Make sure you overwrite and replace the old file!

Please Note:

  • Affiliate links to Clickbank, eBay and Amazon will be cloaked in all posts on your blog, not only in posts created by WP Robot.