Reputation: 6873
I am trying to make an URL like these:
www.website.com/
,
www.website.com
redirect to
www.website.com/members/login
through routes.php.
I have this at the moment: Router::connect('/', array('controller' => 'home', 'action' => 'index'));
How can i setup the route /
to reach my desired url?
Thank you!
Upvotes: 0
Views: 584
Reputation: 4469
You can just replace the line:
Router::connect('/', array('controller' => 'home', 'action' => 'index'));
with:
Router::connect('/', array('controller' => 'members', 'action' => 'login'));
However, I believe you don't want to do this.
Just leave your routes untouched, and set up AuthComponent
properly:
class AppController extends Controller {
// Pass settings in $components array
public $components = array(
'Auth' => array(
'loginAction' => array(
'controller' => 'members',
'action' => 'login',
),
//[...] rest of your Auth options
)
);
For further reference, see Cookbook 2.x: Authentication.
Upvotes: 3
Reputation: 1268
Probably you have AuthComponent somewhere and '/'
is set as dissallowed.
$this->Auth->allow('/')
should help.
Upvotes: 0