Using Gii With URL Rewriting and Path Url Format

Last updated:

When you first try to log into Gii after changing the URL format to "path" in the main config file, like this

'urlManager' => array(
    'urlFormat' => 'path',
    'showScriptName' => false,
    'rules' => array(
        //..routes

you might encounter an error when you first try to access gii, using as url http://example.com/gii: gii 4040 error page

If you get that error message, you might need to add some routes to your config so that Yii can find Gii:

'urlManager' => array(
    'urlFormat' => 'path',
    'showScriptName' => false,
    'rules' => array(
        'gii' => 'gii',
        'gii/<controller:\w+>' => 'gii/<controller>',
        'gii/<controller:\w+>/<action:\w+>' => 'gii/<controller>/<action>',
        //..more routes

Dialogue & Discussion