Page 1 of 1

PHP Redirect - full URL's

Posted: Wed Aug 16, 2006 8:24 am
by DessieD32
Hi

I noticed someone in a previous post mentioned you should use full URLs when doing a header redirect.

Would anyone have any info on why full URL's should be used, and the possible problems with not using them? I'm having a problem with session's (only using IE tho, Firefox is fine) and am beginning to suspect it's down to this.

Any info at all v welcome.

Posted: Wed Aug 16, 2006 8:26 am
by JayBird
Read the manual - http://uk.php.net/header
The manual wrote: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

Posted: Wed Aug 16, 2006 8:27 am
by feyd
HTTP standard is full URL for header redirection.

Posted: Wed Aug 16, 2006 8:30 am
by DessieD32
Thanks for the REALLY fast responses.

My problem is around redirecting and losing SESSION info though I can see theres a lot of help out there on it which I'll start looking at.

What I find strange is the site works fine with Firefox, but not with IE. As the redirect etc is happening server side Im confuised why the browser I use would make any difference.

Cheers

Posted: Wed Aug 16, 2006 8:31 am
by JayBird
DessieD32 wrote:As the redirect etc is happening server side...
That's just it, it isn't...the headers are sent to the client, then the client redirects you.

Posted: Wed Aug 16, 2006 8:33 am
by feyd
We don't need to continue your other thread here, so let's keep both on topic please.

Posted: Wed Aug 16, 2006 8:33 am
by DessieD32
Sorry, and thanks again - clears a lot up for me.