I would like to have urls like this for my project:
domain/ (site/index)
domain/contact.html (site/contact)
domain/about.html (site/about)
domain/some-stuff.html (site/some-stuff)
The only problem i have is the index action from the siteController. I want it to point to dommain/ but when i hide the controller via urlManager and turn on suffix the navWidget generates ‘/.html’ for the first item.
//layout/main.php
'items' => [
['label' => 'Home', 'url' => ['/']],
['label' => 'About', 'url' => ['/site/about']],
['label' => 'Contact', 'url' => ['/site/contact']],
],
//web.php
'urlManager' => [
'class' => 'yii\web\UrlManager',
'enablePrettyUrl' => true,
'showScriptName' => false,
'suffix' => '.html',
'rules' => [
'<alias:index|contact|about>' => 'site/<alias>',
],
]
Do i need to use the .htaccess for this?