Results 1 to 3 of 3

Thread: PHP equivalent of Response.Redirect?

  1. #1
    matthewralston
    Guest
    What is the PHP equivalent to ASP's Response.Redirect?
    I.E. How do I do:
    Code:
    <% Response.Redirect "http://www.mralston.co.uk/" %>
    in PHP?

    I tried doing it with headers:
    Code:
    <? 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?

  2. #2
    Black Cat JoshT's Avatar
    Join Date
    Nov 2000
    Location
    WNY, USA
    Posts
    4,032
    Try just

    Code:
    header ("Location: http://www.mralston.co.uk/");
    and see if that works.

    Josh

  3. #3
    Guest

    Cheers...

    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!

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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width