swl1020
swl1020

Reputation: 823

Redirect to Magento admin dashboard

I've scoured the internet looking for an answer to this, but have found nothing. I have a custom extension. One of the functions will redirect the user to the admin dashboard. How can this be done?

I've tried things like

$this->_redirect("/")
$this->_redirect("*")
$this->_redirect("*/*")

but nothing works.

Upvotes: 0

Views: 3179

Answers (2)

Ben Tideswell
Ben Tideswell

Reputation: 1697

If you're in a controller action, you can use the following:

<?php $this->_redirect('adminhtml/dashboard') ?>

If you're in an Adminhtml controller action, you can use:

<?php echo $this->_redirect('*/dashboard') ?>

This works as Adminhtml is the current module.

Upvotes: 3

Michael Leiss
Michael Leiss

Reputation: 5670

at the end of your controller do:

Mage::app()->getResponse()->setRedirect(Mage::helper('adminhtml')->getUrl('/'));

But this is just what runs through my mind...there are for sure several other ways to achieve this. Like always...

Upvotes: 2

Related Questions