Forum Moderators: coopster

Message Too Old, No Replies

header location on iis

         

Pico_Train

3:10 pm on Jan 13, 2010 (gmt 0)

10+ Year Member



Hi there,

Everything seems to go fine in my code until the header: location bit.

The server is running iis and am using php.

My code is:

header('Location: /admin/index.php?message=success');
exit();

I get this error:
CGI Error
The specified CGI application misbehaved by not returning a complete set of HTTP headers.

Any ideas how I can fix this?

Readie

6:02 pm on Jan 13, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I am not 100% certain of this, but I seem to recall PhP redirection headers need to be the first code processed in the document - which means they need to be at the top of the document.

I can tell you that they will work if you encapsulate them in an if statement though.

coopster

12:59 pm on Jan 22, 2010 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



I'm not very familiar with IIS but perhaps it is because you are not using header() [php.net] correctly. Good practice is to include full host and scheme in the redirection urls. Relative urls are bad practice.

freedy

8:38 pm on Feb 4, 2010 (gmt 0)

10+ Year Member



I had exactly the same error (php5 on iis) and managed to fix it by putting the full domain name in the url

Pico_Train

6:43 am on Feb 8, 2010 (gmt 0)

10+ Year Member



Thanks everyone, seems to have sorted itself out and working well now.