[solved] redirect to controller root?

Hey Guys,

I’m having a admin module and a user controller.

So if I call the URL “domain.com/admin/user” I’m walking through the index-action (or default action if I would define one) and the content will be displayed. so far ok.

So, If i make an update I have the url like “domain.com/admin/user/update/id/1” and if my post walks through the actionUpdate()-Method I want to redirect to the controller root, to that the URL, that is displayed above, is like “domain.com/admin/user”. But if I redirect to my index-action within the Controller, the displayed url is like “domain.com/admin/user/index”. That’s not what I want. Several tries were ineffective - e.g. like “//$this->redirect(’./’);” or “//$this->redirect(’/’);” are not correct.

Can somebody help me?

Thanks & Regards,

Marco

Redirect to an absolute URL, in your controller’s actionUpdate() method:




$url = $this->createAbsoluteUrl('/admin/user');

$this->redirect($url, true);






$this->redirect(array('user/'));



this should work.

thx @ Emily, that’s one possibility!

Oh yes, this works. Thanks. But I thought it should go a littlebit more dynamic, like “$this->redirect($this)” <- something like that, so i don’t have to give a static name.

But now, based on your tip, i found a good solution for me!




$this->redirect(array($this->id."/"));



that works!

Thank you very much!