I wanted to use PrettyURL, So i used this code :
'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>', ), ],
( I don’t know what is the point of the current rules, be glad to someone describe it! )
This works in way, but when i want to send a parameter (like an ID), my URL going to be something like "country/view/?id=123"
And i know that i can add rules to change my URL to "country/view/123"
But my Question #1 is, when Yii code generator, generates a URL, the URL will be like “country/view/?id=123” and it’s not pretty at all, how can i fix that ?
And Question #2 is ( in case that my #1 question is not fixable ), If i’m going to use rules for each specific URL there will be a lot of them, does it make sense ?
Thanks for the answers.