Forum Moderators: coopster

Message Too Old, No Replies

php url redirect

         

TheSeoGuy

9:32 pm on Jul 7, 2004 (gmt 0)

10+ Year Member



I'm very new to php, but is there an object or method that will allow you to redirect the user to a new page?

Much like the Resposne object in asp.

Response.Redirect("url.asp")

Anything like that for php?

Thanks in advance!

yowza

9:35 pm on Jul 7, 2004 (gmt 0)

10+ Year Member



header("Location: [example.com...]

WhosAWhata

11:00 pm on Jul 7, 2004 (gmt 0)

10+ Year Member



as you probably guessed
header("Location:url.asp")
would also work if it is in the same dir

TheSeoGuy

1:16 pm on Jul 8, 2004 (gmt 0)

10+ Year Member



Thank you to the both of you.

I appreciate the help.

dklynn

7:03 am on Jul 10, 2004 (gmt 0)

10+ Year Member



Yes, but the location must be given before ANYthing is sent to the browser (like HTML tags, etc). Be wary as this is a common problem.

DK

WhosAWhata

3:06 am on Jul 11, 2004 (gmt 0)

10+ Year Member



ah...of course
very good of you to point this out

all header information (including cookies and sessions if i'm not mistaken) must be sent before anything is outputted to the browser, like an echo, print, or prrint_r statement

httpwebwitch

3:13 am on Jul 11, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Or even that innocent looking blank space or line break at the top before your first "<?"

we've all been there