Thread: url redirect

    #1
  1. No Profile Picture
    PHP Programmer
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2000
    Posts
    31
    Rep Power
    15
    is there another way of redirecting the client browser in php except for
    header("location: page.html");
    ?
    i know i can use javascript, but i don't like it. and where i use two header() i get an error message, something like "http headers already sent".

    i want to do something like this:
    if(condition) {
    header("location: page1.html");
    }
    else {
    header("location: page2.html");
    }

  2. #2
  3. No Profile Picture
    Apprentice Deity
    Devshed Loyal (3000 - 3499 posts)

    Join Date
    Jul 1999
    Location
    Niagara Falls (On the wrong side of the gorge)
    Posts
    3,237
    Rep Power
    18
    Not with PHP. You can use a meta refresh.

    But the header will work, you just have to do it before sending ANY output to the client. No direct HTML or whitespace, no PRINT() or ECHO(). Not a big deal.

Similar Threads

  1. Replies: 2
    Last Post: April 2nd, 2004, 03:37 AM
  2. Checkbox URL redirect
    By dachamp00 in forum HTML Programming
    Replies: 1
    Last Post: January 5th, 2004, 07:20 PM
  3. jsp forward vs redirect +patterns
    By bculp2000 in forum Java Help
    Replies: 1
    Last Post: December 27th, 2003, 11:49 AM
  4. What to use to redirect to URL
    By Majestic in forum Apache Development
    Replies: 3
    Last Post: September 29th, 2003, 02:26 PM

IMN logo majestic logo threadwatch logo seochat tools logo