Re: Location header does not work?

From: Date: Wed, 04 Aug 2004 07:41:07 +0000
Subject: Re: Location header does not work?
References: 1 2 3 4  Groups: php.general 
Request: Send a blank email to php-general+get-192676@lists.php.net to get a copy of this message
Quoting Justin Patrin <papercrane@gmail.com>: > On Tue, 3 Aug 2004 15:34:27 -0500 (CDT), Bing Du <bdu@iastate.edu> wrote: > > The latest message I got was 'Redirection limit for this URL exceeded. > > Unable to load the requested page.This may be caused by cookies that are > > blocked.'. > > Your page is redirecting you over and over again. Your problem is that > you're not checking for https before you redirect! If the user comes > in with the https URL, you're still redirecting them. Try checking the > value of $_SERVER['HTTPS']. Also, FWIW, you're supposed to also change the HTTP response code to one that explains the reason for the redirect. Some server setups will throw a 500 Server Error if you use just Location. So add the following before any other header output: header($_SERVER['SERVER_PROTOCOL'].' 302 Found'); The HTTP RFC offers various 3xx response codes and you should make the effort of using the appropriate one. Other often useful responses are "301 Moved Permanently" and "303 See Other". The actual text doesn't matter but the code does. -- Romanian Web Developers - http://ROWD.ORG

« previous php.general (#192676) next »