user785179
user785179

Reputation: 917

Yii 1.1.7 - cannot find gii page

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.

Upvotes: 6

Views: 14151

Answers (7)

kussberg
kussberg

Reputation: 559

i have just had the same problem with the URL and Gii and i found out that i had written not the right IP Address. When i changed to the right one from the Network Statistics and then added the IP to the ipFilters of GII.

Hope that helps!

Upvotes: 0

Adrian Gunawan
Adrian Gunawan

Reputation: 14489

I wasn't able to access www.example.org/gii until I added the following in my vhost config

<Directory /path/to/web/root>
  Options Indexes FollowSymLinks MultiViews
    AllowOverride All
    Order allow,deny
    Allow from all
</Directory>

Upvotes: 0

Fydo
Fydo

Reputation: 1424

If you have mod rewrite enabled and want to place the following in your htaccess file

php_value upload_max_filesize 1M
DirectoryIndex index.php

Options +FollowSymlinks
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

and add the following to the 'urlManager' array in your config/main.php file:

'showScriptName'=>false,

Will remove the index.php from your url and make sure to only display urls in the form of domain.com/controller/action

Upvotes: 0

ldg
ldg

Reputation: 9402

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.

Upvotes: 2

k to the z
k to the z

Reputation: 3185

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.

Upvotes: 17

briiC
briiC

Reputation: 2134

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

Upvotes: 3

Chux
Chux

Reputation: 1227

Have you tried with the urlManager desactivated? Just to see if gii itself it's working

Upvotes: 0

Related Questions