这就是我将所有行为路由到index.php的方式,包括子目录请求,HTTP args等.
location / {
try_files $uri $uri/ /index.php?$args; #if doesn't exist, send it to index.php
}
location ~ \.php${
include fastcgi_params;
fastcgi_intercept_errors on;
# By all means use a different server for the fcgi processes if you need to
fastcgi_pass 127.0.0.1:9000;
}
例如,这些被发送到index.php:
http://foo.bar/something/
http://foo.bar/something/?something=1
虽然这些直接转到文件
http://foo.bar/someotherphp.php
http://foo.bar/assets/someimg.jpg