urlManager路由美化

1 nginx 重定向

server {
        listen 80;
        root /vagrant/basic/web;
        index  index.html index.htm index.php;
        server_name www.basic.com;
       location / {
                index index.php;
                if (!-e $request_filename){#
                    rewrite ^/(.*) /index-test.php last;
                }
        }
        location ~ \.php$ {
                fastcgi_split_path_info ^(.+\.php)(/.+)$;
                fastcgi_pass unix:/run/php/php7.1-fpm.sock;
                fastcgi_index index.php;
                include fastcgi_params;
        }
}

2 项目basic/config/web.php components 添加

      'urlManager' => [
            'enablePrettyUrl' => true,
            'showScriptName' => false,
            'enableStrictParsing' => false,
            'rules' => [
            ],
        ],
posted @ 2021-06-22 15:44  胡勇健  阅读(49)  评论(0编辑  收藏  举报