views:

51

answers:

2

I've noticed a curious phenomena popping up in my error logs recently. If, as the result of processing a form, I redirect my users to the URL http://www.example.com/index.php?foo=bar&bar=baz, I will see the following two URLs in my log

http://www.example.com/index.php?foo=barbar=baz
http://www.example.com/index.php?foo=bar&bar=baz

The first one is obviously incorrect and will cause my application to redirect to a 404. It always appears first, usually a second before the second one. The 404 page is not doing the redirection, so it appears that the browser is trying both versions. At first, looking at my server logs made me believe it affected only Firefox 3.6.3, but I've found an example of Safari being afflicted as well. It happens fairly intermittently, though it can occur multiple times in a users' session. I've never been able to get it to happen to me.

Any thoughts as to the nature of the problem or a solution?

Edit: Since it came up in some of the answers, I thought I'd discuss the nature of the redirect. It's being done in PHP using header() to set the Location header. I've never seen a spec that specifically calls for the headers to be URL or HTML encoded, so the URLs aren't encoded or escaped in any way.

A: 

I don't think this will be the browser. See if there are any images being called in the page, or if there is a string function that strips the ampersand. Odd though.

Kevin Sedgley
There is no page. The redirecting page sends out a Location header and exits.
Jeremy DeGroot
A: 

Not sure how you are doing the redirect, but you may need to be URLencoding your URL. The browser may be misinterpreting the barr& as a special character.

May want to review : http://htmlhelp.com/tools/validator/problems.html

Gary