返回归档

Laravel

thinkcmf伪静态文件

用法

thinkcmf伪静态文件

location / {
    if (!-e $request_filename){
        rewrite  ^(.*)$  /index.php?s=$1  last;   break;
    }
}
location /api/ {
  index  index.php index.html index.htm;
  #如果请求既不是一个文件,也不是一个目录,则执行一下重写规则
  if (!-e $request_filename)
  {
  #若是子目录则使用下面这句,将subdir改成目录名称即可。
  rewrite ^/api/(.*)$ /api.php?s=$1;
  }
}

备注

这是从旧博客迁移过来的代码片段,适合在遇到同类问题时快速参考。