PDA

Click to See Complete Forum and Search --> : PHP equivalent of Response.Redirect?


matthewralston
Jan 24th, 2001, 07:06 AM
What is the PHP equivalent to ASP's Response.Redirect?
I.E. How do I do:
<% Response.Redirect "http://www.mralston.co.uk/" %> in PHP?

I tried doing it with headers:<? header("HTTP/1.0 302 Object Moved\nLocation http://www.mralston.co.uk/"); ?> but I just got an internal server error.

So what's the proper way to do it?

JoshT
Jan 24th, 2001, 12:05 PM
Try just



header ("Location: http://www.mralston.co.uk/");



and see if that works.

Josh

Jan 24th, 2001, 05:35 PM
I actually figured it out earlier this evening.

MSDN said:HTTP/1.0 302 Object Moved
Location URL so that's exactly what I used...then it occured to me that the HTTP version & mode (error, not found, ok etc) header would have already been added to the stack and also that it might need a colon because I've successfully sent Content-Type headers before and always used a colon.

Stupid MSDN. Dunno why having two HTTP headers in the stack caused an error though...(according to that now infamous MSDN) the last header of that kind overrides any previously sent... unless it was the lack of a colon that was the problem. Either way MSDN was wrong! :rolleyes:

Anyway, done now...redirect page works...am happy. Cheers! :)