目前我有这段代码:
if (!-e $request_filename)
{
rewrite ^/(.*)$ /index.php?/$1 last;
break;
}
这适用于以下情况:
example.com/foo重定向到index.php
然而example.com/foo?bar不起作用。你如何让它发挥作用?
FWIW:我在 Apache 的 mod_rewrite 等效项中没有遇到这个问题。基本上,我将一个可以工作的站点从 Apache 移到了 Nginx。现在我遇到了这个问题。
编辑:
要清楚这就是我要做的事情:
example.com/fooexample.com/foo/bar/etcexample.com/foo?barexample.com/foo?bar=quz
应该全部index.php“静默”服务而不更改浏览器地址栏的 URL。