: This article mainly introduces how to set defaultAction when setting enablePrettyUrl in Yii2. if you are interested in the PHP Tutorial, refer to it.
When using Yii2, access the http://www.AAA.com if beautifying URLs are enabled, and the http://www.aaa.com/site/index.htmlcontent cannot be displayed directly. In this case, you need to configure rules
'Urlmanager' => ['enableprettyurl' => true, 'showscriptname' => false, 'enablestrictparsing' => true, 'suffix '=> ". html ", 'rules' => ['' => 'site/Index', // If not, the default Action cannot be directly enabled for the access domain name]
Of course, if the default controller and action are not site/index, you should also set the following:
$ Config = ['id' => 'basic ', // 'defaultroute' => 'site/Index ',...
The above describes how to set defaultAction when setting enablePrettyUrl in Yii2, including some content, and hope to help friends who are interested in PHP tutorials.