Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

WordPress MultiSite Link Cloak & Redirection? WordPress


I have many blogs on a WordPress MultiSite install. These use the subdomain method and are mapped into MultiSite, so they run off their own URLs.


They're all affiliate sites using the same affiliate products, and therefore the same affiliate links. I currently use the [[LINK href=""]]Redirection plugin[[/LINK]] but this means manually setting the links & cloaks in WP Admin for <em>every blog</em>. And if I want to change the link, I have to do it manually in WP Admin for <em>every blog</em>.

This sucks and I need a way to set the links once, and all blogs who reference the relative link set use the cloak & redirect, like so .....

<em>Cloak Address</em>

Therefore any blog with the relative link /out/product1 will redirect to the preset affiliate link.

I tweeted the always-helpful [[LINK href=""]]@andrea_r[[/LINK]] who replied about hard-coding the Redirections plugin into mu-plugins. But that is a beyond my skill-set. Can anyone do this, or have any other suggestions? The [[LINK href=""]]Redirection plugin[[/LINK]] is not a one-file plugin; I had a quick look and there are many files and many folders.

I am open to any ideas that work.
The simpler the better.
Link tracker and/or hits are not required.

* Please note *
I am in Australia, so my timezones might be polar opposite to you. I will be offline between midnight and 8am AEST. No need to rush your answers.

Answers (2)


Denzel Chia answers:


I had emailed you a javascript solution.

Please try it out and let me know if this is what you want.


TheLoneCuber comments:

I am doing some research on your suggestion Denzel. It looks like it would work for sure, but I'm worried about redirecting via javascript. All I know about Google and their laws are that they are their own laws. I cannot afford to cop any penalties.

Denzel Chia comments:


The only solution now is to setup your own url shortener using Yourls
A url shortening service is actually a url redirection service.
You do not need the url to be very short, it can be normal long url too.
I am sure this will not violate any Google rules.

Yourls allows you to use it privately. You can login to it's admin panel and create your own "short" link with a custom url. Please see attached image on the Yourls admin.

So for example, you can have a domain name
setup Yourls on it. Login into admin and paste in long affiliate url and type in custom "shorten" url such as and create it.

Now for every blog of your multi site installation, no matter 1000 or how many blogs, just use the same link will redirect user to affiliate link.
And this will be perfectly Google legal because is a url shortener.