Shortened URL Fun!

Discussion in 'Making Money' started by nesterdwarf, Oct 2, 2010.

  1. nesterdwarf

    nesterdwarf Regular Member

    May 30, 2008
    Likes Received:
    State of, Missouri...
    Following this setup, you'll get two benefits.

    First, this is an easy way to research what your twitter followers are interested in without create any content, at least initially. After you've posted a few (thousand ;)) links, you'll be able to target your efforts towards subjects that you know your followers will respond to.

    Second, and this is the evil part, while figuring out exactly what they want, you can still offer broad advertisements by making the changes to the script outlined below. Basically, we will be creating an iframe of whatever links that we shorten, allowing us to advertise via top/bottom divs, float-in ads, popups, etc.

    Ok, the first thing that you want to do is grab the first .zip file here -

    Once you have that, extract the files somewhere that you will remember. Upload all the files to your hosting and follow the installation instructions. When I installed my copy, I had some issues with the redirections that the script tried to run. If that happens to you, just look at the urls that it's trying to send you to and you should be able to sort it all out. Once you have it properly installed, run a few test urls through it and make sure it works.

    So now you have a functional shortener that sends people straight to the destination link... All well and good, and this would let you know what your followers are reading about so you could target those interests. But we want to make some money, right? Changing just a little code and adding a file will let us advertise whatever we want on each of those links.

    First, we'll create the php page with the iframe. Open up your text editor and paste in the following code -

    $target = $_GET["forward"]; 
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
    <html xmlns="">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Untitled Document</title>
    <style type="text/css">
    html, body, div, iframe { margin:0; padding:0; height:100%; }
    iframe { display:block; width:100%; border:none; }
    <iframe src="<?php echo $target ?>" width="100%" height="100%"></iframe>
    Save this file as whatever you want, just remember the name. Upload this file to the root of your YOURLS install and you're done.

    Second, open the folder that you extracted the file to, open the "includes" folder and find the "functions.php" file. Open this in your text editor and find line 729 or search for the text "// Redirect to another page". Within this function, you will see this line of code -

    header("Location: $location");
    Change this line of code to read -

    header("Location: http://YOURDOMAIN/YOURFILE.php?forward=$location");
    Where YOURDOMAIN would be the domain that you uploaded YOURFILE to ;) Save this file and upload it to the "includes" folder of your YOURLS install. Now all the redirects that you post will open in an iframe on your site. And some sites WILL break out of your iframe, and that's fine. You'll still have the information about your folloers reading the post...

    So now you have a functional shortener that opens in all redirected links in a page on your site...what to do with that?


  2. matt1972

    matt1972 Regular Member

    Nov 19, 2009
    Likes Received:
    To make money
    Nice, thanks for the post.