UrlManager setting 'rules' and 'enablePrettyUrl' strange behavior

I’m installed fresh yii2 via Composer and start learning.

Here is a part of my config/web.php:


        'urlManager' => [

           // 'enablePrettyUrl' => true,

            'rules' => [

                'zzz' => 'site/index',

            ],

        ],



I’m trying to get ‘site/index’ via url like: /web/index.php?r=zzz in browser and get 404 error.

And when i uncommenting


'enablePrettyUrl' => true,

browser shows me no error, just normal site/index page.

In phpdoc: https://github.com/yiisoft/yii2/blob/master/framework/web/UrlManager.php

Above $rules I found: This property is used only if [[enablePrettyUrl]] is true.

But why???

I’t soo strange and obscure, in Yii 1 I can set rules and have urls with ‘index.php?r=’.

So how to do this in Yii2? Why U broke this?

I have the same problem. Gii is not working as well when you make ‘enablePrettyUrl’ => true.

Does your gii work?