ZF redirector. Why redirect page doesn't get HTTP_REFERER?
I have two actions in controller:
function indexAction()
{
开发者_Go百科 $this->_redirect('/index/welcome/');
}
function welcomeAction()
{
echo isset($_SERVER['HTTP_REFERER']);
}
After redirect it returns always null. How to fix it?
Redirect (301,303) works on the HTTP level and not the HTML level, i.e. a browser is not aware of the redirect with the exception of the information to update the URL.
This may be:
function welcomeAction()
{
echo isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '';
}
I don't think that it's specified that a client must send the Referer
, so it's very likely that your browser simply doesn't send the Referer
with the redirected request. You can check that using FireBug or some other tool that allows you to inspect the request headers. The Referer
header is described in RFC 2616.
精彩评论