Chances are you’ve probably used UrlManager before, at least to enable “Pretty URLs” and hide index.php from the URL.
//... 'urlManager' => [ 'class' => 'yii\web\UrlManager', 'enablePrettyUrl' => true, 'showScriptName' => false, ], /..
It can do much more than that. Learn how to get the most of it in this tutorial.