Redirect Question

Discussion in 'Hosting Services / Control Panel' started by TomD, May 24, 2007.

Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.
  1. Hello,
    There are a number of links on the internet to our old website (made with php). I need those out-of-date links to be directed toward our new site. For example, a link to our old Update page goes to...

    http://www.blahblahblah.com/information.php?info_id=3&updates

    I now need that old link to be redirected to our new Update page on DiscountAsp.NET. It should now be directed to...

    http://www.blahblahblah.com/t-Updates.aspx

    How can I do this? I have several old pages I need redirect. Thanks for any tips you may have.
     
  2. You can handle the request by a redirect within information.php i.e whenever the user requests for this page(information.php),you can redirect him to the t-Updates.aspx .

    Have something like
    <?php
    header('Location: /t-Updates.aspx'); /* Redirect browser */

    /* Make sure that code below does not get executed when we redirect. */
    exit;
    ?>

    in your information.php

    Vikram

    DiscountASP.NET
    www.DiscountASP.NET
     
  3. Worked perfectly! Thanks much.
     
  4. OK, what if I want to distinguish within a certain php page and redirect from there?

    For example, if Ithe following link...
    http://www.blahblahblah.com/information.php?info_id=3&amp;updates

    I wantit tobe directed to an aspx page...
    http://www.blahblahblah.com/t-Updates.aspx


    But nowI also have...
    http://www.blahblahblah.com/information.php?info_id=4&amp;demo

    And I want this one tobe directedto another aspx page...
    http://www.blahblahblah.com/t-Demo.aspx

    The question is: what code would I put in the 'information.php' page todistinguish between the two and redirect each link properly?
    Thanks.
     
  5. mjp

    mjp

    Try something like this to read the info_id variable:


    <?php
    if ($info_id == "3") {
    header("Location: /t-Updates.aspx");
    } elseif ($info_id == "4") {
    header("Location: /t-Demo.aspx");
    } else {
    header("Location: /xxxxxx.aspx");
    }


    exit;
    ?>


    The "else" is in there to do a redirect on a request that does not include a variable.






    mjp
    DiscountASP.NET
    <SUB><SUP>http://DiscountASP.NET
     
Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.

Share This Page