Redirect page

Discussion in 'PHP' started by samirkumardas, Jun 17, 2008.

  1. #1
    How can I redirect page using PHP?
     
    samirkumardas, Jun 17, 2008 IP
  2. rohan_shenoy

    rohan_shenoy Active Member

    Messages:
    441
    Likes Received:
    20
    Best Answers:
    0
    Trophy Points:
    60
    #2
    Should be done before any output is sent to the browser.
    
    header("Location: http://www.google.com");
    
    PHP:
     
    rohan_shenoy, Jun 17, 2008 IP
  3. samirkumardas

    samirkumardas Banned

    Messages:
    123
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Could you tell what does above line mean?
     
    samirkumardas, Jun 17, 2008 IP
  4. xlcho

    xlcho Guest

    Messages:
    532
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    0
    #4
    This means, that this code must be executed before anything is sent to the browser. Place the line at the top of your code and you won't have any problems
     
    xlcho, Jun 17, 2008 IP
  5. guruguy

    guruguy Active Member

    Messages:
    553
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    60
    #5
    I am interested in this also. Can anyone tell me how to do the type of redirect that says "The page has been moved, redirecting in 5 seconds". Obviously output has been made yet it still redirects. How is this done?
     
    guruguy, Jun 17, 2008 IP
  6. rohan_shenoy

    rohan_shenoy Active Member

    Messages:
    441
    Likes Received:
    20
    Best Answers:
    0
    Trophy Points:
    60
    #6
    ^That is a javascript or meta redirect. Google using those terms. And yea, you will need to have a custom 404 page.
     
    rohan_shenoy, Jun 17, 2008 IP
    guruguy likes this.
  7. guruguy

    guruguy Active Member

    Messages:
    553
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    60
    #7
    OK, thanks for that. I was thinking that due to the style it is implemented in javascript.
     
    guruguy, Jun 17, 2008 IP
  8. Rukna

    Rukna Peon

    Messages:
    80
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #8
    before posting this reply,when i entered my username and pass. then dp automatically redir. it. I want to know that how dp does that.
    plz any good suggestion........
     
    Rukna, Jun 17, 2008 IP
  9. samirkumardas

    samirkumardas Banned

    Messages:
    123
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #9
    Is it possible to redirect without using PHP function?
     
    samirkumardas, Jun 17, 2008 IP