View previous topic :: View next topic |
Author |
Message |
kenknight -
Joined: 10 May 2007 Posts: 8
|
|
Back to top |
|
|
aprelium -
Joined: 22 Mar 2002 Posts: 6800
|
Posted: Mon Oct 22, 2007 4:55 pm Post subject: Re: location header not working properly |
|
|
kenknight,
Is the redirection generated by a script? If so, what is its source code? Otherwise, can you tell us what is causing that redirection? _________________ Support Team
Aprelium - http://www.aprelium.com |
|
Back to top |
|
|
mario50 -
Joined: 26 Oct 2007 Posts: 9
|
Posted: Fri Oct 26, 2007 9:01 pm Post subject: Re: location header not working properly |
|
|
aprelium wrote: | kenknight,
Is the redirection generated by a script? If so, what is its source code? Otherwise, can you tell us what is causing that redirection? |
Hi, I have the same problem here.
I use php code like this to redirect:
header("Location: /somewhere.php");
The php script works fine, redirected without a problem. However, the address bar of the browser did not update properly. And the location info read by JS script will remain the same as it was before the redirection.
Any clue?
Thanks! |
|
Back to top |
|
|
aprelium -
Joined: 22 Mar 2002 Posts: 6800
|
Posted: Tue Nov 13, 2007 3:10 pm Post subject: Re: location header not working properly |
|
|
mario50,
Are you using a frame? What is the browser you're testing with?
Check you access.log file to know if the browser is requesting the redirected page.
If not, this means that the server did an internal redirection (which is unlikely, but we'll ask our developers about that behavior). _________________ Support Team
Aprelium - http://www.aprelium.com |
|
Back to top |
|
|
mario50 -
Joined: 26 Oct 2007 Posts: 9
|
Posted: Tue Nov 13, 2007 8:04 pm Post subject: Re: location header not working properly |
|
|
aprelium wrote: | mario50,
Are you using a frame? What is the browser you're testing with?
Check you access.log file to know if the browser is requesting the redirected page.
If not, this means that the server did an internal redirection (which is unlikely, but we'll ask our developers about that behavior). |
Thanks for asking!
I'm not using a frame (that would be a super low-level mistake), the browser if Safari.
The test case would be:
/index.php:
<?php header("Location: /second.php"); ?>
and by visiting http://127.0.0.1/, the browser successfully displays the content of second.php, but the location bar stays still.
The $_SERVER["REQUEST_URI"] will display the old location as well. So AJAX apps may break. But I've found out that there is a $_SERVER["ORIG_REQUEST_URI"] that has the new location. So this is a work-around for ajax apps.
So I guess this is kind of a "feature" but definitely not a good one.
:-) |
|
Back to top |
|
|
aprelium -
Joined: 22 Mar 2002 Posts: 6800
|
Posted: Wed Nov 14, 2007 2:24 pm Post subject: Re: location header not working properly |
|
|
mario50,
It's internal redirection in action. That's not a bad feature since it saves your system a whole response-request. The downside is that it behaves as you described.
To force a classical redirection, add the following header() statement before sending Location:
Code: | header("Status: 301"); |
This will force an external redirection and a behavior like the one you've been expecting. _________________ Support Team
Aprelium - http://www.aprelium.com |
|
Back to top |
|
|
hbr -
Joined: 24 Nov 2006 Posts: 1
|
Posted: Wed Jan 09, 2008 8:56 am Post subject: |
|
|
hi,
I also had some problems with php redirections.
Every header ("Location: URL") did not work, if a form's action IS A.PHP where I do a header("Location B.PHP"), the script stops at A.PHP and shows A.PHP in the address bar.
The problem persisted even after reinstalling XP Pro SP2 and Abyss 2.5/php5.2/Mysql5 .
I solved it by using 127.0.1.1 instead of localhost, it worked for few redirections and after that the problem appeared again :s |
|
Back to top |
|
|
aprelium -
Joined: 22 Mar 2002 Posts: 6800
|
Posted: Wed Jan 09, 2008 9:38 pm Post subject: |
|
|
hbr,
Please contact our technical support about that issue. _________________ Support Team
Aprelium - http://www.aprelium.com |
|
Back to top |
|
|
Vahn -
Joined: 10 Aug 2005 Posts: 51 Location: At my computer
|
Posted: Mon Jan 28, 2008 1:08 am Post subject: |
|
|
you should also note that if you have something like this:
Code: |
<Html>
<Head>
<?php
header("Location: Redirectto.php");
?>
and so on...
|
it should cause problems
something like:
Code: |
<?php
echo 'Yay i win!';
header("Location: Redirectto.php");
?>
|
-should- also cause problems..
there shouldn't be any output before the header line, you can have code, but no output....
now i tried to do some " lets mess it up on purpose " but it worked anyways >.> idk if thats good or bad, mind if we can see some of the a.php ( from the beginning up to the header line should be good. )
-Vahn _________________ A ship in the harbor is safe, But thats not what Ships were Built for. ~ John Shedd
Success Comes before Work only in the Dictionary ~ Harvey Mackay
|
|
Back to top |
|
|
|