我试图将运行symfony框架的php网站迁移到nginx和php over fastcgi.
从http://wiki.nginx.org/开始使用Symfony howto一切正常,但我遇到了自定义重写规则的问题.
我的目标是将/ aaaa形式的URL重写为/ view/shorthand/aaaa.然后应该由php和symfony对请求进行处理.
旧的apache重写规则:
RewriteRule ^([0-9a-f]+)$ index.php/view/shorthand/$1 [L]
Run Code Online (Sandbox Code Playgroud)
我尝试过的Nginx规则:
rewrite ^/([0-9a-f]+)$ /view/shorthand/$1 break;
rewrite ^/([0-9a-f]+)$ /index.php/view/shorthand/$1 break;
Run Code Online (Sandbox Code Playgroud)
他们都被发送到fastcgi但是request_uri似乎仍然是/ aaaa,因为我收到此错误:
FastCGI sent in stderr: "Action "aaaa/index" does not exist" while reading response header from upstream
Run Code Online (Sandbox Code Playgroud)
我也尝试过使用try_files而没有任何运气.请指教.