yii2 美化url的方法

在frontend/config/main.php中的

'user' => [
    'identityClass' => 'common\models\User',
    'enableAutoLogin' => true,
    'identityCookie' => ['name' => '_identity-frontend', 'httpOnly' => true],
],
下面添加
'urlManager' => [
'enablePrettyUrl' => true,
'showScriptName' =>false,
'suffix' => '.html',
],



另外,需要在frontend/web的目录下面放上附件文件。

htaccess

把上面附件解压。

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注