Forum Moderators: coopster
Does anyone know how to fix IE's (6.0) issue with php redirecting long urls? I know the url is formatted correctly because everything is working fine in mozilla and also if I manually cut and paste the url into internet explorer. For some reason however, the header(location) function will not redirect to the appropriate location in IE (it redirects to "/").
What I want to do is simple:
$go_to_url = "http://verylongdynamicurl";
header("location: $go_to_url");
After wasting a month of affiliate income on this site not realizing IE wasn't redirecting, suggestions on how to get this fixed asap would be greatly appreciated.
Thanks,
Chris
*I will not get used to only using mozilla*
*I will not get used to only using mozilla*
*I will not get used to only using mozilla*
*I will not get used to only using mozilla*
header("Location: $go_to_url"); Supposedly IE is picky about that. If that doesn't work there's some interesting user comments on this page [us4.php.net] (php.net).
I'm at a complete loss here. I've spent 3 hours trying to figure out what's going on. Much longer and I'm going to be prematurely bald from all the hair I'm pulling out.
No matter what I do, internet explorer will simply not accept and pass on the url. What I find the most infuriating is that if I manually set the variable equal to the url (rather than dynamically generating it, the redirect works fine.
This works
$go_to = "http://somelongurl";
header("Location: $go_to");
This does not work
$go_to = "http://start";
$go_to .= "op%3Dadd";
$go_to .= "%26type%3D".$type;
...
/* After a number of lines, $go_to is now the same as it was in the above example*/
header("Location: $go_to");
What happens in the bottom case, instead of forwarding to $go_to, the page forwards back to my site's homepage, i.e. ("/").
Does anyone know what's going on? I'm utterly and completely at a loss now.
Thanks,
Chris
What I find the most infuriating is that if I manually set the variable equal to the url (rather than dynamically generating it, the redirect works fine.
Then you are doing something in your code that, when generating the url, changes it in some way and that change is tolerated by some browsers, but not by IE.
Have you tried outputting the generated url and just stopping and then cutting and pasting into IE to see what happens?
>>Then you are doing something in your code that, when generating the url, changes it in some way and that change is tolerated by some browsers, but not by IE.<<
I would have thought so too, I've painstakingly compared every single character to the one that prints out, and it's exactly the same. I've checked three times.
>>try generating them with the = and & instead of %3D and %26<<
Trying this right now.
Where is your '?'
Did you miss out on the '?'. Of course you know that the dynamic URLs look like [domain.com?id1=abc&id2=xyz...]
Arun
<?php$url=substr($_SERVER['QUERY_STRING'],4);
header('Location: ['.$url);...]?>
The length 4 is just the length of the string url= and must be changed if you use a different name.
In fact, I suppose that those fanatic about conserving bytes could just use this--
<?php
header('Location: ['.$_SERVER['QUERY_STRING']);...]
?>
[edited by: jatar_k at 7:04 pm (utc) on April 20, 2004]
[edit reason] removed url [/edit]
echo "Location: $go_to_url\n\n";
Maybe "header()" adds other headers that IE doesn't like? (I'm not really a php person, so I don't know what the header() function actually does...just a thought.)
I've got it fixed and working now and to be honest I really haven't a clue what was wrong. In the end I just ended up scrapping the whole script and restarting it from scratch. Lost a day but it's working again so at this point I'm content. :)
Thanks again,
Chris