thinkphp Nginx伪静态

  • 过滤api前缀
    location / {
    add_header Access-Control-Allow-Origin *;
    add_header Access-Control-Allow-Methods 'GET, POST, OPTIONS';
    add_header Access-Control-Allow-Headers 'DNT,Keep-Alive,User-Agent,Cache-Control,Content-Type,Authorization';

    if ($request_method = 'OPTIONS') {
    return 204;
    }

if (!-e $request_filename){
rewrite ^/api/(.*)$ /index.php?s=$1 last; break;
}
}

  • 不过滤api
    location / {
    add_header Access-Control-Allow-Origin *;
    add_header Access-Control-Allow-Methods 'GET, POST, OPTIONS';
    add_header Access-Control-Allow-Headers 'DNT,Keep-Alive,User-Agent,Cache-Control,Content-Type,Authorization';

if ($request_method = 'OPTIONS') {
return 204;
}

if (!-e $request_filename){
rewrite ^(.*)$ /index.php?s=$1 last; break;
}
}

posted @   zjMars  阅读(234)  评论(0编辑  收藏  举报
点击右上角即可分享
微信分享提示