When I started to play a little bit with the scaffolding, I observed, that redirections are not working. So, I tested the redirectTo and redirectToAction methods, but they don't do anything. The URL remains the same and the page becomes blank. What would be the problem?
CommentAuthorfrantzdae
I just turned on the AK_LOG_EVENTS, and got the following log: Tue, 15 Sep 2009 23:39:11 +0200 [MESSAGE] [0;32mRequest[0m from 127.0.0.1 PARAMS{ - controller: cumi - action: atiranyit - ak: cumi/atiranyit - AK_9f24b2: nlofef3786o6e0e15of9qiejd5 - AK_5c9e2e: 8fsdtjf2do982ot5hjthc1gi61 - format: html - id: } Tue, 15 Sep 2009 23:39:11 +0200 [MESSAGE] Redirected to http://www.google.com Tue, 15 Sep 2009 23:39:11 +0200 [MESSAGE] Sending header: HTTP/1.1 200 OK Tue, 15 Sep 2009 23:39:11 +0200 [MESSAGE] Sending header: Content-Encoding: gzip Tue, 15 Sep 2009 23:39:11 +0200 [MESSAGE] Sending header: Location: http://www.google.com Tue, 15 Sep 2009 23:39:11 +0200 [MESSAGE] Sending header: Connection: close
CommentAuthorfrantzdae
The log shows that everything is ok, but eventually the redirect doesn't happens.
CommentAuthorfrantzdae
Finally I found a solution:
At the bottom of the sendHeaders function (in lib/AkResponse.php), is a line:
which terminated the script before the redirection. So I deleted it and now the redirection works fine :) What is the purpose of this line? Has any special purpose?
CommentAuthorfirodj
The purpose of these line is to stop executing following scripts after redirectTo().
For example:
... If (true) { $this->redirectToAction('login'); // the script should be stop here, and don't execute further/below scripts, ... // and the browser should receive the headers for redirection. } $this->render(array('action' => 'listing')) ...