Yii 1.1.7 - cannot find gii page
Solution 1
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.
Solution 2
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
Solution 3
Can you post your entire urlManager block with @briiC.lv's code incorporated? It should work, it's pretty much the same as mine:
'urlManager'=>array(
'urlFormat'=>'path',
'rules'=>array( // remove gii for production:
'gii'=>'gii',
'gii/<controller:\w+>'=>'gii/<controller>',
'gii/<controller:\w+>/<action:\w+>'=>'gii/<controller>/<action>',
'site/index'=>'/',
'<controller:\w+>'=>'site/<controller>',
'<filter:(proj|dept)>/<id:\d+>'=>'site/',
),
'showScriptName'=>false,
),
If it still doesn't work, you might also want to post/link to your complete main.config file.
user785179
Updated on June 04, 2022Comments
-
user785179 almost 2 years
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.
-
user785179 almost 13 yearsUnfortunately this did not have any effect. Still cannot get gii to work with your code when I replaced it with yours.
-
user785179 almost 13 yearsPERFECT! Now gii works without the urlManager! So how do I get urlManager working AND gii working?
-
user785179 almost 13 yearsThe thing is that I know the urlManager is working (sort of) because my site pages looked like "www.example.org/site/about". Now when I disabled urlManager, they look like index.php?r=site/page&view=about, but gii works! It is as if urlManager does not know about the gii page. Could this be a bug???
-
k to the z almost 13 yearsRefer to my answer below, user.
-
user785179 almost 13 yearsUnfortunately stackoverflow won't let me copy/paste my entire main.php file. Too many characters It is still not working, even with briiC.Iv's code.
-
user785179 almost 13 yearsYes, that works!!! Now this means I also get to keep my urlManager working for clean URL's! Thank you!
-
Vicer over 11 yearsthanks! I also had clean urls on and was wondering why the heck it didn't work for me as shown on the tutorial using index.php?r=gii ..:P
-
k to the z over 11 yearsIt's the little things that hold you up when you're first getting to know the framework. Glad we have a good Yii community here to speed things up for you.
-
nimbusgb almost 10 yearsWhats more it's poorly written 'getting started' documents that slow you down even more. You follow their suggested route and it simply doesn't work.