'enablePrettyUrl' => true, Gii problem

My Gii only works without ‘enablePrettyUrl’ => true.

http://localhost/index.php?r=gii works fine.

If I change config\web.php to ‘enablePrettyUrl’ => true, then

http://localhost/gii shows a "not found" error.

Shouldn’t it work? Am I doing something wrong?

This is my config:




        'urlManager'=>[

            'enablePrettyUrl' => true,

            'showScriptName' => false,

            'suffix'=>'.sk',

            'rules'=>[

                //   '<controller:\w+>/<id:\d+>'=>'<controller>/view',

                //   '<controller:\w+>/<action:\w+>/<id:\w+>'=>'<controller>/<action>',

                //   '<controller:\w+>/<action:\w+>'=>'<controller>/<action>',

            ],



Thank you for any help.

Hello this is my main.php config file in common folder, i can access gii without index.php

I have created htaccess file under frontend/web folder




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




<?php

return [

    'vendorPath' => dirname(dirname(__DIR__)) . '/vendor',

    'bootstrap' => ['gii'],

    'modules' => [

        'gii' => 'yii\gii\Module',

        // ...

    ],

    'components' => [

        'cache' => [

            'class' => 'yii\caching\FileCache',

        ],

        'urlManager' => [

        'class' => 'yii\web\UrlManager',

        // Disable index.php

        'showScriptName' => false,

        // Disable r= routes

        'enablePrettyUrl' => true,

        'rules' => array(

                '<controller:\w+>/<id:\d+>' => '<controller>/view',

                '<controller:\w+>/<action:\w+>/<id:\d+>' => '<controller>/<action>',

                '<controller:\w+>/<action:\w+>' => '<controller>/<action>',

        ),

        ],

    ],

];



Got it!

The problem is with


'suffix'=>'.sk'.

If you establish a suffix you must use that suffix when calling gii.

In this case I should be typing http://localhost/gii.sk instead of http://localhost/gii.

::)

Thank you Ervin anyway…