Page 1 of 1

Header Redirection .. what can stop it working?

Posted: Mon Aug 21, 2006 8:54 am
by onion2k
On a lot of my sites I use:

Code: Select all

header("Location: nextpage.php");
to move users from one page to another. It's great, For 99.9% of users it works fine. However, very occasionally a user will complain that their browser "hangs" at the point I would expect them to be forwarded to the next page. What's up with that? What can stop it forwarding?

Things to consider:

1. It works for most people therefore it's very unlikely to be a code issue.
2. I definitely haven't outputted anything prior to sending the header.
3. No matter what I try I cannot replicate the problem.
4. I know I should be using a fully qualified URL, but I don't believe that to be the issue.
5. It's not a problem with a specific browser, some users get the problem with IE.

Re: Header Redirection .. what can stop it working?

Posted: Mon Aug 21, 2006 9:19 am
by Benjamin
onion2k wrote: 4. I know I should be using a fully qualified URL, but I don't believe that to be the issue.
Thats gotta be it. Maybe you can replace it with a full url on a few pages and see if the problem goes away on those pages. I can't think of anything else it could be.

Posted: Mon Aug 21, 2006 9:23 am
by Jenk
iirc, some browsers (or an option within most browsers when set to off) do not follow header redirects.

meta-tag redirects should work however.

Posted: Mon Aug 21, 2006 2:39 pm
by Chris Corbyn
Try placing exit() after the call....

It may be an idea to fallback with a meta redirect too like Jenk says, although I've never had to do that. Opera used to refuse to follow my reidrects when I had pages redirecting to other pages which made new redirects (not infinitely, just multiple hops).

EDIT | Is this a T&D question? :?: 8)

Posted: Mon Aug 21, 2006 3:17 pm
by onion2k
d11wtq wrote:It may be an idea to fallback with a meta redirect too like Jenk says, although I've never had to do that. Opera used to refuse to follow my reidrects when I had pages redirecting to other pages which made new redirects (not infinitely, just multiple hops).
Ah. AH. Now that might explain it. I am doing that in a few places.
d11wtq wrote:EDIT | Is this a T&D question? :?: 8)
It's not really a 'PHP - Code' question or a 'Clientside' question. So yes.