Kostas Livieratos
Kostas Livieratos

Reputation: 1067

CakePHP redirect from plugin issue

I've made a CakePHP plugin. The code in PluginNameController extending PluginNameAppController is the following:

class PluginNameController extends PluginNameAppController {
    public function index() {
        $this->redirect(array('plugin' => false, 'controller' => 'users', 'action'=> 'login'));
    }
}

which should prompt users to log in, in order to make use of it,if they're not already logged in. But this redirects to something like example.com/plugin_name/users/login and not at example.com/users/login, which is what I desire! Can you help me out here?

Thank you in advance!

Upvotes: 0

Views: 1582

Answers (1)

Vicky
Vicky

Reputation: 171

Try this:-

public function index() {
        $this->redirect(array('plugin' => null, 'controller' => 'users', 'action'=> 'login'));
    }

Upvotes: 1

Related Questions