Multiple redirects based on keyword

Discussion in 'PHP' started by aj22, Aug 19, 2007.

  1. #1
    aj22, Aug 19, 2007 IP
  2. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #2
    
    $locations = array(
        // Keyword => URL
        'green'  => 'http://example.com',
        'red'    => 'http://example.com',
        'blue'   => 'http://example.com'
    );
    
    if (isset($locations[$_GET['keyword']]))
    {
        header('Location: '. $locations[$_GET['keyword']]);
    }
    else
    {
        header('Location: http://example.com/default.html');
    }
    
    exit();
    
    PHP:
     
    nico_swd, Aug 19, 2007 IP
  3. aj22

    aj22 Peon

    Messages:
    643
    Likes Received:
    30
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Perfect - thanks.
     
    aj22, Aug 19, 2007 IP