htaccess or redirect to cloak portion of a link?

What you need to do is set up a custom rewrite. This can change something like http://site.com/rotate/1 to http://site.com/wp-content/plugins/ad-rotating-plugin/rotate.php?trackerid=1

Here is some untested code that might help:

<?php
/*
Plugin Name: Your Plugin
Plugin URI: 
Description: 
Version: 0.1
Author: 
Author URI: 
*/

// Add rewrite rule and flush on plugin activation
register_activation_hook( __FILE__, 'ad_rotate_activate' );
function ad_rotate_activate() {
    ad_rotate_rewrite();
    flush_rewrite_rules();
}

// Flush on plugin deactivation
register_deactivation_hook( __FILE__, 'ad_rotate_deactivate' );
function ad_rotate_deactivate() {
    flush_rewrite_rules();
}

// Create new rewrite rule
add_action( 'init', 'ad_rotate_rewrite' );
function ad_rotate_rewrite() {
    add_rewrite_rule( 'rotate/([^/]+)','/wp-content/plugins/ad-rotating-plugin/rotate.php?trackerid=$matches[1]','top' );
}

Leave a Comment