雷林鹏分享:YAF 在Nginx环境下的Rewrite规则

  这2天在学习YAF框架,在nginx环境下参照手册配置rewrite规则后,访问页面出现404错误,最后发现是rewrite规则书写上出现了些错误。

  手册提供的Nginx的Rewrite:

  server {

  listen ****;

  server_name domain.com;

  root document_root;

  index index.php index.html index.htm;

  if (!-e $request_filename) {

  rewrite ^/(.*) /index.php/$1 last;

  }

  }

  错误的地方在:

  rewrite ^/(.*) /index.php/$1 last;

  正确的写法为:

  rewrite ^/(.*) /index.php?$1 last;

  修改完后,重启nginx,访问 http://yourhost/sample/index/index/index/name/ 就可以看到熟悉的 hello world!.

  文章转载自 [http://www.php230.com](编辑:雷林鹏 来源:网络 侵删)

猜你喜欢

转载自www.cnblogs.com/linpeng1/p/10843903.html