[thelist] having problems with php redirect form

Anthony Baratta Anthony at Baratta.com
Fri Sep 20 01:12:01 CDT 2002

At 10:40 PM 9/19/2002, Timothy J. Luoma wrote:

>but this isn't coming close to working.  I've checked PHP.net and Google
>but I must either be trying to look for something so obvious I can't
>find it or I'm using the wrong keywords.
>Does anyone have a pointer or working example?  I'm stumped here.


header("Location: http://www.example.com/"); /* Redirect browser */
exit;                 /* Make sure that code below does
                          not get executed when we redirect. */

Note: HTTP/1.1 requires an absolute URI as argument to Location: including
the scheme, hostname and absolute path, but some clients accept relative
URIs. You can usually use $_SERVER['HTTP_HOST'], $_SERVER['PHP_SELF'] and
dirname() to make an absolute URI from a relative one yourself:

header("Location: http://".$_SERVER['HTTP_HOST']
Anthony Baratta
Keyboard Jockeys

"Conformity is the refuge of the unimaginative."

More information about the thelist mailing list