ewil_l 发表于 2014-3-9 15:19:45

nginx对ci路径进行重写没有效果,求帮助!

nginx已经可以访问ci了,但是重写url的时候怎么样都没有反应,我察看了php的访问日志,同样的请求访问,路径正确,但是通过第一条规则重写后报404错误。。。

也就是说,如果直接手动敲 http://www.xxxx.com/home/article 是可以访问的,但是如果路径是: http://www.xxxx.com/h/who/article/124 这样访问的话,就不行了。rewrite的flag = last 和 break是不行的,flag = redirect就没有问题,可是我不想改变浏览器地址,请问有什么解决方法吗?我搞了一天都没有什么头绪。


if (!-e $request_filename)
{
            rewrite /h/(.*)/(.*)/(.*)$ /index.php/home/article break;
            rewrite ^/(.*)$ /index.php/$1 last;
}



ewil_l 发表于 2014-3-9 15:44:05

简单地说就是内部跳转不了:Q

edgeto 发表于 2015-5-6 17:17:48

location / {
            index index.php;
            if (!-e $request_filename) {
                rewrite ^/(.*)$ /index.php?$1 last;
                break;
            }   
      }
页: [1]
查看完整版本: nginx对ci路径进行重写没有效果,求帮助!