Reputation: 1074
Hello and thanks for reading .
I have installed the yii user module and iam trying to link to the profile page using the following code ;
'url' => Yii::app()->getModule('user')->profileUrl),
in my main.php i have the following;
'urlManager' => array(
'urlFormat' => 'path',
'showScriptName' => false,
'caseSensitive' => false,
'rules' => array(
'gii' => 'gii',
'<controller:\w+>/<id:\d+>' => '<controller>/view',
'<controller:\w+>/<action:\w+>/<id:\d+>' => '<controller>/<action>',
'<controller:\w+>/<action:\w+>' => '<controller>/<action>',
'<action>' => 'site/<action>',
),
),
and in my htaccess file i have this ;
RewriteEngine on
# if a directory or a file exists, use it directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# otherwise forward it to index.php
RewriteRule . index.php
It works and i get redirected to http://localhost/spob/user/profile
but when i clcik on another link that links to my protected/views eg 'url' => array('employercontract/index')),
i get the following error Error 404
Unable to resolve the request "user/employercontract/index".
The correct path would be http://localhost/spob/employercontract/index
without the user path.
I think that the problem could be in the main.php , where i declare the rules, any suggestion would be much appreciated i have been trying for the whole morning to solve this issue
Upvotes: 0
Views: 1828
Reputation: 4461
If I understood you correct...
Try to replace this
'url' => array('employercontract/index'))
with this
'url' => array('/employercontract/index'))
Note leading slash. This will tell UrlManager that link should be created based on site root. Whithout it - link is based on current module(user module in your case).
I hope this helps.
Upvotes: 3