Redirection in html and php

Discussion in 'General Chat' started by moeen, Mar 19, 2007.

  1. #1
    Can anyone please tell me the redirection code in php and html.

    I want my root/index.php to be redirected to root/directory/index.php.
     
    moeen, Mar 19, 2007 IP
  2. Kerosene

    Kerosene Alpha & Omega™ Staff

    Messages:
    11,366
    Likes Received:
    575
    Best Answers:
    4
    Trophy Points:
    385
    #2
    Put this in your root/index.html or /index.php

    HTML
    <meta HTTP-EQUIV="REFRESH" content="0; url=http://www.whatever.com/directory/index.php">
    Code (markup):
    PHP
    <?
    header("HTTP/1.1 301 Moved Permanently");
    header("Location: http://www.whatever.com/directory/index.php");
    exit;
    ?>
    Code (markup):
     
    Kerosene, Mar 19, 2007 IP
  3. moeen

    moeen Well-Known Member

    Messages:
    232
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    108
    #3
    Thanks Kerosene
     
    moeen, Apr 3, 2007 IP
  4. Coolalex

    Coolalex Banned

    Messages:
    2,691
    Likes Received:
    160
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Make sure you only use the 401 redirects though or google will hate you :D
     
    Coolalex, Apr 3, 2007 IP
  5. saadahmed007

    saadahmed007 Admínistratör

    Messages:
    5,272
    Likes Received:
    869
    Best Answers:
    0
    Trophy Points:
    380
    #5
    lol Alex, it's 301 redirect not 401 :)
    Saad
     
    saadahmed007, Apr 3, 2007 IP
  6. Coolalex

    Coolalex Banned

    Messages:
    2,691
    Likes Received:
    160
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Oops I guess I havent redirected anything for awhile

    [/giving advice for stuff I havent known for awhile]
     
    Coolalex, Apr 3, 2007 IP
  7. moeen

    moeen Well-Known Member

    Messages:
    232
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    108
    #7
    I used pho redirect, not html. I think that no one hates that.
     
    moeen, Apr 4, 2007 IP
  8. Kerosene

    Kerosene Alpha & Omega™ Staff

    Messages:
    11,366
    Likes Received:
    575
    Best Answers:
    4
    Trophy Points:
    385
    #8
    Coolalex - that scared me ... you just made me go check all my redirects to make sure they're weren't 401s!

    Then I came back here and read saadahmed007s reply :p
     
    Kerosene, Apr 12, 2007 IP