こんにちは、読んでくれてありがとう。
私は yii ユーザー モジュールをインストールしており、次のコードを使用してプロファイル ページにリンクしようとしています。
'url' => Yii::app()->getModule('user')->profileUrl),
私のmain.phpには次のものがあります。
'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>',
),
),
私のhtaccessファイルにはこれがあります。
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
それは機能し、リダイレクトされhttp://localhost/spob/user/profile
ますが、保護された/ビューにリンクする別のリンクをクリックすると、たとえば'url' => array('employercontract/index')),
、次のエラーが表示されますError 404
Unable to resolve the request "user/employercontract/index".
。正しいパスはhttp://localhost/spob/employercontract/index
ユーザーパスなしです。
問題は、ルールを宣言する main.php にある可能性があると思います。この問題を解決するために午前中ずっと試してきた提案があれば大歓迎です