My custom redirection / link cloaking script

3 replies
Hi all,

I keep seeing here and there some threads asking how to cloak a link and / or redirect. Granted there are WordPress plug-ins for this, but not everyone uses WP and even if you do this may come in handy.

So here's my own custom script. With it you can define as many links as you like and even include a delay so the redirection is not instant.
Just put it on your own domain, call it whatever-you-like.php (but something not obvious... Don't call it redirect.php!), copy one of the links blocks and increase the index (so the next block in this example would be link[2] and so on), then load the script like this in your browser:

your_domain.com/script_name.php?dest=1&d=2

... Where dest is the destination - i.e. the link's index - and d a delay in seconds to wait before redirecting (useful when you don't want the redirection to be detected by a bot).

Note that each link block is made of 3 lines: the actual link, the title, and the picture (I added this one to be able to pin it on Pinterest). If you don't have a picture just leave that last one out.

Seb.

Code:
<?php

//Links list
$links=array();

$links[0]['link']="https://www.amazon.com/dp/B0063ER12C/ref=as_li_tf_til?tag=freeway2wea07-20&camp=0&creative=0&linkCode=as1&creativeASIN=B0063ER12C&adid=1JA5K7PDFX4YPQ53ZK75&";
$links[0]['title']="14K White Gold, Round, Blue Diamond Stud Earrings";
$links[0]['pic']="http://ecx.images-amazon.com/images/I/41SVjHfVd7L._SS400_.jpg";

$links[1]['link']="https://www.amazon.com/dp/B006R11LZO/ref=as_li_tf_til?tag=freeway2wea07-20&camp=0&creative=0&linkCode=as1&creativeASIN=B006R11LZO&adid=1KV2DCY4613SFQMRJPQ4&";
$links[1]['title']="Royal Diamond Apple Green Shamballa Swarovski Crystal Stone Balls Shamballa Bracelet";
$links[1]['pic']="http://ecx.images-amazon.com/images/I/51s0m3FpmkL._SS420_.jpg";

// URL variables
$destination = $links[$_GET["dest"]]['link'];
$title = $links[$_GET["dest"]]['title'];
$pic = $links[$_GET["dest"]]['pic'];
if(!isset($_GET["d"])) { 
$d=0;
} else {
$d=$_GET["d"];
}


echo '
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="content-type">
<title>'.$title.'</title>';
if($no_redirect != 1)
{
echo '<meta http-equiv="refresh" content="'.$d.';url='.$destination.'" /> 


</head>
<body>
<p style="text-align: center; font-size: 18px; margin-top:  20px;">Your request is loading, please wait.<br>If you are not  redirected automatically within '.$d.' seconds, <a  href="'.$destination.'">click here</a>.</p>';
if(!empty($pic)) {
echo '<p style="text-align: center;><a href="'.$destination.'"><img src="'.$pic.'"></a></p>';
}
echo '</body>
</html>
';
} else {
echo '
</head>
<body>
<p style="text-align: center; font-size: 16px;">you are about to  take a $597 Internet Marketing video course... For $10! <a  href="'.$link.'">Click here.</a>.</p>
</body>
</html>
';
}

?>
#cloaking #custom #link #redirection
  • Profile picture of the author Fahmzie
    Nice! Simple and handy script, thanks mate
    {{ DiscussionBoard.errors[6210205].message }}
  • Profile picture of the author OldLodgeSkins
    You're welcome.
    Signature
    Do you use Facebook ? Then you can make money just by inviting people to a Facebook group ! It's called the Instant Income System. How cool is that?
    {{ DiscussionBoard.errors[6211555].message }}
    • Profile picture of the author rivox1
      Hello,

      Thank you for helping the community by posting this script. I found it very helpful!

      However, I am having a small issue with the script. I am working on a Mac and it works flawlessly on Safari, Chrome, and Firefox, however, I can't get it to work on ANY windows machine, (IE, Firefox, or Chrome)

      Do you have any idea of what may be causing this bug?

      I am using your script to redirect a page from adfly to its destination. The reason I'm using your script to re-direct to the final page is because I don't want my clients to see in their Google Analytics that the traffic is coming from adfly and by-pass me next time they want to order more traffic.

      If you want please tell me how I can make available to you the modifications (link, etc) I made to your script.

      I am immensely thankful for any help you can provide. Thank you in advance for your time and help!
      {{ DiscussionBoard.errors[6534435].message }}

Trending Topics