Keyword based redirect?

Kingfresh

Regular Member
Joined
Jul 8, 2009
Messages
369
Reaction score
297
Hey guys, how i can build a script or what code i have to include into a script to build a keyword based redirect?


I dont want to link p1-->p2 etc.

I want to link p1-->redirect script -->p2,p3,p4


So if i click money , it loads the script and redirect me to money.html etc. instead of direct linkin ... is there anything out there?

thanks!
 
You mean something like this?

redirect.php

PHP:
<?php

    switch($_GET['keyword'])
    {
        case 'cars':
            $uri = '/cars.html';
        break;

        case 'stacks':
            $uri = '/stacks.html';
        break;

        // Multiple matches for a single destination page
        case 'money':
        case 'cash':
        case 'hoes':
            $uri = '/jay-z.html';
        break;

        default:
            $uri = '/'; // Redirect to homepage if no match...
        break;
    }
    
    header("Location: $uri");

?>

And you would link to it like this:

Code:
http://yoursite.com/redirect.php?keyword=money
 
hey buddy thanks!

and is there anyway to combine it with a redirect script?

here is mine:
PHP:
<?php
require_once("geoip.inc");

$gi = geoip_open("GeoIP.dat",GEOIP_STANDARD);

$country_code = geoip_country_code_by_addr($gi, $_SERVER['REMOTE_ADDR']);
geoip_close($gi);

if($country_code == 'US')
{
        header('Location: /fbappguide.com/offer/us/');
}
elseif($country_code == 'DE')
{
        header('Location: http://fbappguide.com/offer/de/');
}
elseif($country_code == 'GB')
{
        header('Location: http://GBTraffic.com');
}
elseif($country_code == 'CA')
{
        header('Location: http://CATraffic.com');
}

else {
        header('Location: http://AllTraffic.com');
}
?>
 
hey buddy thanks!

and is there anyway to combine it with a redirect script?

PHP:
<?php 

    require_once('geoip.inc');

    $gi = geoip_open('GeoIP.dat',GEOIP_STANDARD);
    $country_code = geoip_country_code_by_addr($gi, $_SERVER['REMOTE_ADDR']);
    geoip_close($gi);

    switch($country_code)
    {
        case 'US':
            $uri = '/fbappguide.com/offer/us/';
        break;

        case 'DE':
            $uri = 'http://fbappguide.com/offer/de/';
        break;

        case 'GB':
            $uri = 'http://GBTraffic.com';
        break;

        case 'CA':
            $uri = 'http://CATraffic.com';
        break;

        default:
            $uri = 'http://AllTraffic.com';
        break;
    }

    header("Location: $uri");

?>
 
without the redirect.php i need to redirect directly like the below example:

Code:
http://yoursite.com/?money

as it mentioned as money it should redirect to the specified page


You mean something like this?

redirect.php

PHP:
<?php

    switch($_GET['keyword'])
    {
        case 'cars':
            $uri = '/cars.html';
        break;

        case 'stacks':
            $uri = '/stacks.html';
        break;

        // Multiple matches for a single destination page
        case 'money':
        case 'cash':
        case 'hoes':
            $uri = '/jay-z.html';
        break;

        default:
            $uri = '/'; // Redirect to homepage if no match...
        break;
    }
    
    header("Location: $uri");

?>

And you would link to it like this:

Code:
http://yoursite.com/redirect.php?keyword=money
 
Back
Top