2012-05-21 47 views
0

什么我得到的是:nginx的路径改写

/index.php/rest/item/1 

然而,应该去:

/rest/item/1 

我怎么可以重写每一个请求从/index.php/rest/到/休息/?

谢谢!

编辑: 看来,如果我让一个重定向到只工作:

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

如果我使用“破发”或“最后”这404对我来说,任何想法?我使用Gallery3,它是用php的Konoha框架编写的。

回答

2

在过去的几周里,我和德米特里一起解决了这个问题,最终我们发现了问题所在。我只是需要它,确保它在处理规则时不会完成。从规则中删除“最后”或“中断”可修复该问题:

if (!-e $request_filename) { 
     rewrite ^/index.php/rest/(.*)$ /rest/$1; 
     rewrite ^/(.+)$ /index.php?kohana_uri=$1 last; 
} 
+0

然后,您应该将此标记为接受的答案。 – asymmetric