1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

[REQ] PhP script to redirect 50-50% the traffic

Discussion in 'Black Hat SEO Tools' started by Hunwarrior, Aug 25, 2010.

  1. Hunwarrior

    Hunwarrior Jr. VIP Jr. VIP Premium Member

    Joined:
    May 12, 2010
    Messages:
    1,027
    Likes Received:
    859
    Hi guys,

    Would some code minded guy share a script which would redirect my traffic
    50% to link1
    50% to link2

    If i can set up/modify the ratios, even better!

    Thanks, REP is in store.

    ps: hope it is in the right section
     
  2. brazero

    brazero Newbie

    Joined:
    Oct 30, 2009
    Messages:
    9
    Likes Received:
    1
    There is a simple way, not absolutly accurate but it might work

    PHP:
    <?php
    $urlone
    ="SITE-ONE-URL-HERE";
    $urltwo="SITE-TWO-URL-HERE";
    $num=rand(0,100);
    if(
    $num<50) { header("Location :$urlone); die; }
    else { header("
    Location :$urltwo"); die; }
    ?>
    if you want to change ratio, change the "50"
    50 = 50/100 -> siteone
    40 = 40/100 -> siteone
    ...

    it's random redirection, if you want perfect 50/50, you have to use a sql base or external file...
    if needed, just ask
     
    • Thanks Thanks x 1
  3. Hunwarrior

    Hunwarrior Jr. VIP Jr. VIP Premium Member

    Joined:
    May 12, 2010
    Messages:
    1,027
    Likes Received:
    859
    whatever i am doing, i have syntax error at line 3 ... :S
     
  4. cyklotrial

    cyklotrial Regular Member

    Joined:
    Oct 13, 2008
    Messages:
    248
    Likes Received:
    82
    Location:
    Wonderland
    Try this one
    PHP:
    <?php
    $urlone
    ='http://google.com';
    $urltwo='http://yahoo.com';
    $num=rand(0,100);
    if(
    $num<50) { header("Location :$urlone"); die; }
    else { 
    header("Location :$urltwo"); die; }
    ?> 
    brazero
    If you dont have any variables in string allways use single quote (') instead of double(") it's much faster cos PHP interpreter is not searching variable in string
     
    • Thanks Thanks x 1