CrazyCat
(Crazycat)
1
Hello there,
I’ve a small trouble with the login url and path urlformat.
My application is deployed on different servers, sometimes in a subdir. When an user tries to go on a protected page, he must be redirected to the site/login page. But I’ve mistakes because if he tryes to go on http://mydomain.tld/subdir/index.php/controller/action/, the rewriting gives http://mydomain.tld/subdir/index.php/controller/action/site/login. And if I use /site/login/, I loose the /subdir/.
And I’ve the same trouble with the errorAction.
Is there any way to solve it dynamically (without having a config file for each server) ?
Sound like issue with path-format. so you need to modify urlManager array.
'urlManager'=>array(
...
..
)
or try -
// application components
'components'=>array(
'user'=>array(
'loginUrl' => array('site/login'),
),
)
CrazyCat
(Crazycat)
3
I actually have:
'components' => array(
'user' => array(
'allowAutoLogin' => true,
'loginUrl' => 'site/login',
),
'urlManager'=>array(
'urlFormat'=>'path',
'rules'=>array(
'<controller:\w+>/<id:\d+>'=>'<controller>/view',
'<controller:\w+>/<action:\w+>/<id:\d+>'=>'<controller>/<action>',
'<controller:\w+>/<action:\w+>'=>'<controller>/<action>',
),
),
'errorHandler' => array(
'errorAction' => 'site/error',
),
It works well if I tryed to access http://mydomain.tld/subdir/index.php/controller but fails if I’ve a final slash or anything after the controller.
I’m sure I’ve a mistake somewhere, but can’t understand where neither wich
Bizley
(Bizley)
4
Do you have baseUrl set in your config? You can set this value differently depending on the server.
alirz23
(Alirz23)
5
this should resolve it
'loginUrl' => array('site/login'), // try wrapping it in array
CrazyCat
(Crazycat)
6
YES !
I knew there was a simple way, but I didn’t think trying this. Works perfectly !
Thanks a lot.
@Rohit Suthar : sorry, I didn’t noticed you used array too, I didn’t have my eyes opened yesterday 