url path format

Hi,

How do I set in Yii2 the equivalent to :


'urlManager'=>[

            'urlFormat'=>'path',



I would like to use


http://localhost/skate/site/index/lang/en.sk

instead of


http://www.lernius.org/skate/site/index.sk?lang=en

just like I used to to in yii 1.1

is this possible?

right now this url returns a not found error:


http://localhot/skate/index.php/site/index/lang=pt.sk

My SiteController:




    public function actionIndex($lang='')

    {

        if ($lang!=''):

            yii::$app->language = $lang;

            Yii::$app->session->set('lang',$lang);

        endif;


        return $this->render('index');

    }



My config:




        'urlManager'=>[

            //'urlFormat'=>'path',

            '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

1: Edit config in config\web.php


'urlManager' => [

            'enablePrettyUrl' => true,

            'showScriptName' => false,

            'suffix' => '.php',

            'rules' => [

                // your url config rules''

            ]

        ],

2: Insert .htaccess in you web folder path

Example my web: C:\xampp\htdocs\basic\web

rules in .htaccess inside a directory localhost\your_web_path


Options +FollowSymLinks

IndexIgnore */*


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

*** be sure to configure mod_rewrite is enabled in apache ***

Nope. Does not work.

I read about AllowOverride All in Apache Conf. But I can’t implement it because my hosting service doesn’t allow it and, for some reason, it doesn’t work in .htaccess.

Apparently, Yii 2 assumes that AllowOverride is set to All. But newer versions of Apache have it set to none.

It seems that Yii2 may not be quite mature yet, or this is poorly documented.