I want to use Gii in Yii. My protected/config/main.php for my first webapp has this part uncommented, as instructed in the Yii documentation to enable Gii (123.45.67.123 is my public IP address from the computer I am trying to access):
'modules'=>array(
// uncomment the following to enable the Gii tool
'gii'=>array(
'class'=>'system.gii.GiiModule',
'password'=>'123456',
// If removed, Gii defaults to localhost only. Edit carefully to taste.
'ipFilters'=>array('123.45.67.123','127.0.0.1','::1'),
),
),
I also have the urlManager enabled in my protected/config/main.php by uncommenting the below:
// uncomment the following to enable URLs in path-format
'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>',
),
),
When I go to my Yii site, for example, www.example.org, the basic Yii page is loaded fine. When I do www.example.org/gii, I get a 404. When I go to www.example.org/index.php?r=gii, I get a 404. Why is my Gii page not found? I am using CentOS 5.6.
Try:
http://www.example.org/index.php/gii
It seems you have the same rules as I do for url. If http://www.example.org brings you to your main yii webapp page then the above link should work.
You were going to http://www.example.org/gii which is incorrect.
Im using urlManager like this for gii
'urlManager'=>array(
'urlFormat'=>'path',
'cacheID' => false,
//'caseSensitive' => true,
'showScriptName' => false,
'urlSuffix' => '/',
'rules'=>array(
'gii'=>'gii',
'gii/<controller:\w+>'=>'gii/<controller>',
'gii/<controller:\w+>/<action:\w+>'=>'gii/<controller>/<action>',
...
and it doesn't conflict with routes for other site pages
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With