I tried to solve this myself but I give up. I want to serve static pages using standalone action (The Definitive Guide to Yii 2.0: Rendering Static Pages).
SiteController::actions()
return [
'page' => [
'class' => 'yii\web\ViewAction',
],
]
urlManager configuration:
'showScriptName' => false,
'enablePrettyUrl' => true,
'rules' => [
'<alias:about>' => 'site/page/view/<alias>',
],
It looks okay, unfortunately //localhost/about gives 404 (exception ‘yii\base\InvalidRouteException’ with message ‘Unable to resolve the request “site/page/view/about”.’).
I noticed that //localhost/site/page?view=about works fine however I would prefer to skip controller name and ?view=about part. This looks like a bug for me but maybe I’m just doing something wrong.
I’ll be grateful for your help.