How to do a redirect on a url with a fragment?

Hi. How to do a redirect on a url with a fragment? example 'http://test.com/main#test'

return $this->response->redirect(array('for' => 'main'));

I'd try this:

function someAction() {
    $this-response->redirect($this->url->get(['for'=>'main']).'#test');
    return;
}


6.8k

Yes I can. But I guess it's not right?!

I'd try this:

function someAction() {
  $this-response->redirect($this->url->get(['for'=>'main']).'#test');
  return;
}

Why not right ? I guess phalcon is not supporting location hash fragment.



1.0k

You need the second parameter for this:

return $this->response->redirect($this->url->get(array('for' => 'main')) . '#test', true);

I've done this in Phalcon 2.0.10



6.8k

Many thanks to all for the reply. I understood that phalcon does not support fragment, so I'll use the above code.