您好,欢迎来到 猿书

伪静态设置

apache

web/.htaccess
web/admin/.htaccess
web/api/.htaccess

你只需要保证apache的AllowOverride为All

nginx

server {
    server_name www.yourserver.com;
    listen 80;
    index index.html index.htm index.php;
    root your-yii2cmf-path/web;
    location / {
        try_files $uri $uri/ /index.php?$query_string;
    }
    location /admin {
        try_files $uri $uri/ /admin/index.php?$query_string;
    }
    location /api {
        try_files $uri $uri/ /api/index.php?$query_string;
    }
    location ~ \.php$ {
        fastcgi_pass 127.0.0.1:9000;
        include fastcgi.conf;
    }
}

满足以上条件后,可以到模块管理urlrule模块配置开启url美化

1 条评论

  • test 发表于 2019-02-20 10:41

    大师,URLrule优化配置和原生的配置是否一致