try_files
receives a list of arguments representing which files Nginx should pass the request on to. For example: try_files $uri $uri/ index.php =404
informs Nginx that it should try to match a request against $uri
(the requested path as a file name, post-rewrites) $uri/
(the requested path as a directory, post-rewrites), then to try index.php
, and if all else fails, return an HTTP 404 Not Found error code. Another example: to map every request to a index.php, regardless of it s URI, use try_files index.php =404;
.
在这种情况下,我不认为是你要求的最佳指令。 相反,考虑使用改写规则将<代码>/widget/1/2/3改为/index.php?type=widget&a=1&b=2&c=3