Yii でリダイレクトが多すぎるとエラーが発生します。
Yii が提供するデフォルトの accessControl フィルターを使用しています。
アプリケーション全体は、私が WAMP を使用している localhost で完全に動作します。ステージングサーバーにアップロードした後、問題が発生し始めました。
私の知る限り、.htaccessファイルを構成しました
Options +FollowSymLinks
IndexIgnore */*
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^.*$ /index.php [L]
</IfModule>
ログインが不要なアクションを開こうとすると、問題なく開きます
public function accessRules()
{
return array(
array('allow', // allow all users to perform 'index' and 'view' actions
'actions' => array('index', 'locationImport', 'contact'),
'users' => array('*'),
),
array('allow', // allow authenticated user to perform 'create' and 'update' actions
'actions' => array('LocationImport'),
'users' => array('@'),
),
array('allow', // allow admin user to perform 'admin' and 'delete' actions
'actions' => array('admin', 'delete'),
'users' => array('admin'),
),
array('deny', // deny all users
'users' => array('*'),
),
);
}
上記のコントローラーでは、連絡先が機能しています。
私のmain.php関連
'user' => array(
// enable cookie-based authentication
'allowAutoLogin' => true,
'loginUrl' => array('/useraccount/login'),
'class' => 'CPWebUser',
),
UserAccountController のアクセス ルール
public function accessRules()
{
return array(
array('allow', // allow all users to perform 'register' and 'login' actions
'actions' => array('register', 'login', 'view', 'xxxx', 'xxxx',),
'users' => array('*'),
),
array('allow', // allow authenticated user to perform 'create' and 'update' actions
'actions' => array('update', 'logout', 'home', 'changePassword'),
'users' => array('@'),
)
array('deny', // deny all users
'users' => array('*'),
),
);
}
要約するだけです。localhost で完全に動作します。sitecontroller Actioncontact は動作します。userAccountController のアクションは機能しません。登録すらせず、ログインにリダイレクトします。actionLogin が開きません。