Problem using enablePrettyUrl

Hello

I create a basic project, and set enablePrettyUrl = true. The default template work well, but when I click on link "About" for example I receive this error:

Not Found

The requested URL /site/about was not found on this server.

I creates a .htaccess file :




RewriteEngine on

RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule . index.php



Create virtual host:




<VirtualHost *:80>

  ServerName        test.dev

  DocumentRoot      /xx/basic/web/


  <Directory "/xx/basic/web">

    Options         FollowSymLinks Includes

    AllowOverride   All

    Order           allow,deny

    Allow           from All

  </Directory>

</VirtualHost>



create host:

127.0.0.1 test.dev.

This is my web.php:




<?php


$params = require(__DIR__ . '/params.php');


$config = [

    'id' => 'basic',

    'basePath' => dirname(__DIR__),

    'bootstrap' => ['log'],

    'components' => [

        'request' => [

            // !!! insert a secret key in the following (if it is empty) - this is required by cookie validation

            'cookieValidationKey' => 'yii2_rest',

            //Configurando o input via JSON.

            'parsers' => [

                'application/json' => 'yii\web\JsonParser',

            ]

        ],

        'cache' => [

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

        ],

        //Componente yii\web\User que gerencia o status de autênticação dos usuários.

        'user' => [

            'identityClass' => 'app\models\User',//Classe de identidade para o yii\web\User.

            'enableAutoLogin' => false, //Impede que o estado de autênticação seja guardado em cookie.

            'enableSession' => false, //O status de autênticação do usuário não deve ser mantido em sessão.

            'loginUrl' => null, //Força mostrar o erro 403 em vez de redirecionar para a página de login.

        ],

        'errorHandler' => [

            'errorAction' => 'site/error',

        ],

        'mailer' => [

            'class' => 'yii\swiftmailer\Mailer',

            // send all mails to a file by default. You have to set

            // 'useFileTransport' to false and configure a transport

            // for the mailer to send real emails.

            'useFileTransport' => true,

        ],

        'log' => [

            'traceLevel' => YII_DEBUG ? 3 : 0,

            'targets' => [

                [

                    'class' => 'yii\log\FileTarget',

                    'levels' => ['error', 'warning'],

                ],

            ],

        ],

        'db' => require(__DIR__ . '/db.php'),

        'urlManager' => [

            

            'enablePrettyUrl' => true, //Habilita URL's amigáveis

            'showScriptName' => false,

            'rules' => [

                [

                    'class'=>'yii\rest\UrlRule',

                    'pluralize'=>false,

                    'controller' => 'api/default',

                ],

            ],

        ],

        'authManager' => [

            'class' => 'yii\rbac\PhpManager',

        ]

    ],

    'params' => $params,

    'modules' => [

        'api' => [

            'class' => 'app\modules\api\apiModule',

        ],

    ],

];


if (YII_ENV_DEV) {

    // configuration adjustments for 'dev' environment

    $config['bootstrap'][] = 'debug';

    $config['modules']['debug'] = [

        'class' => 'yii\debug\Module',

        // uncomment the following to add your IP if you are not connecting from localhost.

        //'allowedIPs' => ['127.0.0.1', '::1'],

    ];


    $config['bootstrap'][] = 'gii';

    $config['modules']['gii'] = [

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

        // uncomment the following to add your IP if you are not connecting from localhost.

        //'allowedIPs' => ['127.0.0.1', '::1'],

    ];

}


return $config;




But dont work any link.Where I wrong?

Hard to see the answer from here, but I’d try to reduce the configurations to the minimum for UrlManager as in http://www.yiiframework.com/doc-2.0/guide-runtime-routing.html#using-pretty-urls

just let ‘enablePrettyUrl’ => true,

Problem fixed. I change httpd.conf file

AllowOverride All