views:

510

answers:

1

On a project I'm working on, I am using HTTP headers to redirect the user to the frontpage after a successful login;

header("Location: http://example.com/index.php?");
exit(0);

EDIT: Added questionmark to url to show the problem

This works fine in all browsers tested - however, in Firefox 3.0.6, both on windows, mac and debian, it fails to set the hyperlinks properly. Every single hyperlink points to the same URL the redirect points to, completely ignoring the "href" attribute. Refreshing the page does not help - I have to re-enter the URL manually and hit enter for the hyperlinks to start working again.

I've tried this in IE6, IE7, Opera and Safari, and it works fine. I'm assuming something is wrong with the way I implement the redirect, could anyone point me in the right direction?

+1  A: 

The solution seems to be this: I cannot redirect to a url ending with a questionmark, if I do, this problem will occur. It would seem to me this is not expected behavior from FF3, but I don't know the HTTP-spec's well enough to say if that's the case.

Either way, problem solved by removing question-mark from redirect url.

Jacob Hansson