Redirecting a site visitor based an a certain condition

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ifedi
    New Member
    • Jan 2008
    • 60

    Redirecting a site visitor based an a certain condition

    What's the neatest way to redirect a site visitor to another page using php, based on one or more conditions? I've already used header('Loacati on: another.php') in many of my scripts, but I find that there are problems sometimes.
    I tried http_redirect() , but it seems I needed to put a number of things together to let my 'localhost' be able to word with it.
    Any help'll be appreciated!
  • Markus
    Recognized Expert Expert
    • Jun 2007
    • 6092

    #2
    As far as i know header("Locatio n: ... is the best way to deal with redirecting..

    Comment

    • ronverdonk
      Recognized Expert Specialist
      • Jul 2006
      • 4259

      #3
      Originally posted by ifedi
      What's the neatest way to redirect a site visitor to another page using php, based on one or more conditions? I've already used header('Loacati on: another.php') in many of my scripts, but I find that there are problems sometimes.
      I tried http_redirect() , but it seems I needed to put a number of things together to let my 'localhost' be able to word with it.
      Any help'll be appreciated!
      I agree with markusn00b. When you say you are (sometimes) having problems with header(..), you should solve that problem (probably "Cannot modify headers ...etc.... " msg) and then use the header() command to redirect.

      Ronald

      Comment

      • ifedi
        New Member
        • Jan 2008
        • 60

        #4
        Originally posted by ronverdonk
        I agree with markusn00b. When you say you are (sometimes) having problems with header(..), you should solve that problem (probably "Cannot modify headers ...etc.... " msg) and then use the header() command to redirect.

        Ronald
        Thanks guys for your comments. Don't really think it was a "Cannot modify headers ...etc.... " msg (which has to do with placing any browser output before the headers() is called), though I can't now pull out the exact situation where I had problems (limitations) with header().
        At any rate, what's http_redirect() about, what has it got over headers() and how can I build its support into php?
        As always, thanks.
        Ifedi.

        Comment

        Working...