Website Cloaking Script
I have been doing a lot of affiliate marketing lately and one of my biggest concerns is always protecting my landing page from competitors. Since I’m tracking every visitor that comes to my landing page, I can get a good idea of how many of those visits are competitors looking for ideas for their sites. I can’t really blame them, I check up on my competitors as well. This doesn’t mean I don’t attempt to protect myself.
With the help of Ben from WickedFire.com I put together a short script that will cloak your site from anyone not coming from the exact sources you specify. You can even white list IP addresses to make sure no direct traffic comes to the site that doesn’t belong there. Be careful with that one since you might be sending away actual customers. I always redirect to the offer page just to be certain.
So, here is the script:
<?phpif(!empty($_SERVER['HTTP_REFERER'])) {
$referer = parse_url($_SERVER['HTTP_REFERER']);preg_match('/[^.]+\.[^.]+$/', $referer['host'], $match);
if ($match[0] != 'trafficsource.com') {
header("Location: http://www.offerpage.com"); //redirect all traffic that comes from any source except the one listed above
exit;
}
}if(empty($_SERVER['HTTP_REFERER'])) {
$visitor = $_SERVER['REMOTE_ADDR'];if (!(preg_match("/xx.xxx.xxx.xx/",$visitor)) && !(preg_match("/yy.yyy.yyy.yy/",$visitor))) {
header('Location: http://www.offerpage.com?subid=directTraffic'); //redirect all IP addresses to this that are not the IP addresses listed above
exit;
}
}?>
This should do the trick. Remember to fill out the correct information in the script, it won’t “just work.” One last thing to remember is that when you enter a traffic source, it should be the root domain (myspace.com, google.com, facebook.com) and nothing else. The script will parse the referring source down to just the root domain. You can add as many IP addresses as you want just by adding another AND (&&) operator. You can also tweak this code to cloak your site anyway you want. Hope you enjoy!
Related posts:



Twitter Me!
Matthew! The one-two punch today huh? First I have to get the other thing working properly, then I will tackle this. Thanks.
Hi Matthew,
Thanks for sharing that script with us. I can see
how that can be helpful in the future. After just
gleaming over a some of your posts, I can see you
provide valuable content–enough for me to add your
blog to ig.
I’m new at Affiliate Marketing and I will definitely
make sure to come back regularly when I’m ready to
take affiliate marketing to the next level, beyond
my existing internet marketing knowledge and skill
set.
All the best,
Bryan
thanks…feel free to ask me any questions.
This is great validation and helps us understand just how to learn more of your content
Matt,
is this script to cloak a page?…or a domain?…i am more interested in domain cloaking……where the page is blank….yet acts as a “bridge” from one site to another…..lets users thru…and sends SE spiders to the content page….how do i do this?
Matt,
is this script to cloak a page?…or a domain?…i am more interested in domain cloaking……where the page is blank….yet acts as a “bridge” from one site to another…..lets users thru…and sends SE spiders to the content page….how do i do this?
would appreciate the help….
thanks!