Note that there are some explanatory texts on larger screens.

plurals
  1. POPHP application- something blocks redirect to url
    primarykey
    data
    text
    <p>I have weird problem with redirection in Zend Framework 2, but I think framework doesn't matter here since it works correctly on localhost. I'm trying to solve this for 2 days. </p> <p>On my localhost my first Zend 2 app works excellent, so I decided to move it on live server, and here it comes.<br> One of my action is:</p> <pre><code>public function unknowAction() { ... //var_dump($obj-&gt;getLink()); // Return string with url address $this-&gt;redirect()-&gt;toUrl($obj-&gt;getLink()); //return false; // Tried with and without this } </code></pre> <p>As I mentioned, on localhost it works perfect, but on live server it doesn't redirect to provided url.</p> <p>On live server above action return HTTP Request Code 302, but it stay on the same page. Like something would block it.</p> <p>I created php file with:</p> <pre><code>&lt;?php header('Location: http://www.google.pl',true,302); ?&gt; </code></pre> <p>Just to check if my server doesn't have disabled redirection somehow, but this script redirected without any problems.</p> <p>I added at top in my index.php</p> <pre><code>ini_set('display_errors',1); ini_set('display_startup_errors',1); error_reporting(-1); </code></pre> <p>But I get no error, no warning, everything seems to be ok. </p> <p>So here is my question to Stackoverflow's Experts.<br> What may block redirection? Where should I look? What should I check?</p> <p>Here is .htaccess, it's pretty standard for Zend 2, just first and last two lines are added by me.</p> <pre><code>AddHandler x-httpd-php5-3 .php RewriteEngine On RewriteCond %{REQUEST_FILENAME} -s [OR] RewriteCond %{REQUEST_FILENAME} -l [OR] RewriteCond %{REQUEST_FILENAME} -d RewriteRule ^.*$ - [NC,L] RewriteCond %{REQUEST_URI}::$1 ^(/.+)(.+)::\2$ RewriteRule ^(.*) - [E=BASE:%1] RewriteRule ^(.*)$ %{ENV:BASE}index.php [NC,L] RewriteRule index.php / [L] php_flag eaccelerator.enable 0 php_flag eaccelerator.optimizer 0 </code></pre> <p><strong>Update</strong> In my action I tried:</p> <pre><code> public function unknowAction() { ... return $this-&gt;redirect()-&gt;toUrl($obj-&gt;getLink()); } </code></pre> <p>This way I get blank page, which browser display in Quirks Mode. I checked this in Firebug and in response I get following characters at top of html structure (it's invisible)</p> <pre><code>ďťż </code></pre> <p>Currently, I'm looking for BOM in my files.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload