How to config yii2 urlManager rules? -


here yii2 code in main.php:

'urlmanager' => [             'baseurl' => $baseurl,             'class' => 'yii\web\urlmanager',             'enableprettyurl' => true,             'showscriptname' => false,             'suffix' => '.html',             'rules' => [                 // site controller                 '' => 'site/index',                 'contact_us' => 'site/contact',             // sitemap controller               'sitemap' => 'sitemap/index'             ] 

and url in browser is: + site controller: - http://localhost/neko/ - http://localhost/neko/contact_us.html + sitemap controller: - http://localhost/neko/sitemap/index.html

how configure sitemap controller http://localhost/neko/sitemap.xml?

use array configuration sitemap.xml, that:

'rules' => [     // site controller     '' => 'site/index',     'contact_us' => 'site/contact',     // sitemap controller     [         'pattern' => 'sitemap',         'route' => 'sitemap/index',         'suffix' => '.xml',     ], ], 

see docs.


Comments

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -