yii伪静态配置

文章描述:

Yii伪静态如何配置

 

默认

Home

http://localhost/index.php?r=site%2Findex

About

http://localhost/index.php?r=site%2Fabout

 

伪静态

nginx配置

location / {
    # Redirect everything that isn't a real file to index.php
    try_files $uri $uri/ /index.php?$args;
}

 

Yii根目录config/web.php

打开注释代码:

'urlManager' => [
    'enablePrettyUrl' => true,
    'showScriptName' => false,
    'suffix'=>'.html',// 统一后缀名,若不需要则无需配置
    'enableStrictParsing'=>false,//默认为false,是否采用严格解析
    'rules' => [
    ],
]

 

效果

http://localhost/site/index.html

http://localhost/site/about.html

发布时间:2022/08/15

发表评论