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: http://yourdomain.com/go/Link_Title/2021/1. 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]+)/?$ http://YOURDOMAIN.com/wp-content/plugins/WPRobot3/cloak.php?post_id=$2&link_num=$3&cloaked_url=$0 [L]
RewriteRule ^go/([^/]+)[/]?$ http://YOURDOMAIN.com/wp-content/plugins/WPRobot3/cloak.php?name=$1&cloaked_url=$0 [L]
</IfModule>
# 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.
As I understand, the cloaking used to hide an Affiliate ID.
But is it really valued information? Or it may be abused by someone?
Thanks
Comment by Zenya — November 30, 2009 @ 3:07 am
No, I am not aware of any way to abues affiliate IDs. Most people use link cloaking to improve Google rankings and hide the affiliate links from visitors.
Comment by admin — December 6, 2009 @ 7:33 pm
Have a quick stupid question….my WP cloaking info is right under # BEGIN WordPress…it doesn’t have to be above that, does it???
Comment by Shannon — December 6, 2009 @ 10:17 pm
One more question…Will WP Robot automatically cloak links on all pages as well as posts? I’m still seeing the amazon link on the pages.
Comment by Shannon — December 6, 2009 @ 11:57 pm
No it should be fine if it is below the “# BEGIN WordPress” part only.
Regarding your second question: WP Robot is only cloaking links in all your posts currently, not pages.
Comment by admin — December 7, 2009 @ 4:26 pm
Hi,
A suggestion:
Would it be possible to include a “hop tracking id” field for the clickbank options? I suggest this for an upcoming version.
Comment by Claes — January 8, 2010 @ 5:16 pm
Thats Great Step by Step explainations… 🙂 i am noob, but even i did this very well…. i love that forum support 😀 thanks Again for valuable time for writting this.
Comment by India — January 14, 2010 @ 7:14 pm
Hi,
I have been trying to get WProbot to work on our server. We have IIS6 and I can get the site to work without any cloaking ok after the installation of the ISAPI dll that helps with permalinks. But as soon as I enable permalinks the site is down. I am not sure if there is anyone else who has tried this and got it to work. We have a dedicated server and i would love to get this to work on a windows server. If there is anyone out there who can help me – or guide me – as I am new to Php and WordPress… I would really appreciate it!
Comment by Ayda — January 21, 2010 @ 1:44 pm