我正在用PHP Yii框架开发网站,我现在是堆栈,我需要启动gii,但我不能这样做。当我键入www.example.com/index.php/gii或www.example.com/gii时,它显示以下错误:
/gii/default/login // <- website redirects to here
This webpage has a redirect loop
The webpage at http://www.example.com/gii/default/login has resulted in too many redirects.
Clearing your cookies for this site or allowing third-party cookies may fix the problem.
If not, it is possibly a server configuration issue and not a problem with your computer.我不认为这个错误是因为修改了htaccess和主配置,但不管怎样,下面是main.php配置文件:
'urlManager'=>array(
'urlFormat'=>'path',
'showScriptName'=>false,
'rules'=>array(
'site/page/<view:\w+>'=>'site/page',
'<controller:\w+>/<cact:\w+>/<action:\w+>'=>'<controller>/<cact>',
'<controller:\w+>/<id:\d+>'=>'<controller>/view',
'<controller:\w+>/<action:\w+>/<id:\d+>'=>'<controller>/<action>',
'<controller:\w+>/<action:\w+>'=>'<controller>/<action>',
),
),和.htaccess:
Options +FollowSymLinks
IndexIgnore */*
RewriteEngine on
#non-www to www
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
# 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 [L]所以你能帮帮我吗?
发布于 2012-03-15 01:47:18
检查配置文件中的gii模块是否存在且未注释。如果gii不在其中,您应该将其添加到模块数组中。
'modules'=>array(
'gii'=>array(
'class'=>'system.gii.GiiModule',
'password'=>***choose a password***
),
),有关gii here的更多信息
发布于 2012-10-08 16:50:55
要使用以下路径:index.php?r=gii/default/login,您必须在/protected/config/main.php中关闭url管理器
发布于 2012-11-12 21:22:16
同时检查一下urlManager的rules。这就是我的问题:
'components' => array(
'urlManager' => array(
'urlFormat' => 'path',
'showScriptName' => false,
'rules' => array(
// ...
// will handle `gii/default/login` uri and makes infinite redirection loop circle
'<controller:\w+>/<action:\w+>/<sub_action:\w+>'=>'<controller>/<action>',
// ...
),
),
),https://stackoverflow.com/questions/9707004
复制相似问题