By default, Zend_Http_Client automatically handles
HTTP redirections, and will follow up to 5 redirections. This can be
changed by setting the 'maxredirects' configuration parameter.
According to the HTTP/1.1 RFC, HTTP 301 and 302
responses should be treated by the client by resending the same request to the
specified location - using the same request method. However, most
clients to not implement this and always use a GET request when
redirecting. By default, Zend_Http_Client does the same - when
redirecting on a 301 or 302 response, all GET and POST parameters
are reset, and a GET request is sent to the new location. This
behavior can be changed by setting the 'strictredirects' configuration
parameter to boolean TRUE:
Example 464. Forcing RFC 2616 Strict Redirections on 301 and 302 Responses
<?php
// Strict Redirections
$client->setConfig(array('strictredirects' => true));
// Non-strict Redirections
$client->setConfig(array('strictredirects' => false));
You can always get the number of redirections done after sending a request using the getRedirectionsCount() method.




