It’s not a simple process, but you can do it with some javascript code.
Not to be shilling or anything, but my plugin Simple Facebook Connect makes this a LOT easier.
Step 1: You need a Facebook Application for your website. SFC guides you through this and configures the javascript on your site.
Step 2: You add some Like buttons. SFC lets you do this automatically or manually with function calls.
Step 3: You add some special javascript code to catch the edge-creation. Here’s an example of doing this with SFC:
add_action('sfc_async_init','like_detect_edges');
function like_detect_edges() {
?>
FB.Event.subscribe("xfbml.render", function() {
FB.Event.subscribe("edge.create", function(targetUrl) {
alert('edge.create: '+targetUrl);
});
FB.Event.subscribe("edge.remove", function(targetUrl) {
alert('edge.remove: '+targetUrl);
});
});
<?php
}
This adds some code to the initialization phase of the FB javascript such that the like and unlike events will be captured and trigger some javascript code.
Now, I used alert’s here, but if you were to change the document.url there, then the page would redirect.
Doing this without SFC is a bit more complex. You have to add your own initialization code, the loader for FB’s all.js, the like button XFBML, etc.