Redirect 使用Nginx重定向url

Redirect 使用Nginx重定向url,redirect,nginx,Redirect,Nginx,如何重定向到使用nginx假设url字符串可以是任何内容,在使用命名位置重写URI之前,您将测试原始文件是否存在。例如: root /path/to/root; location / { try_files $uri $uri/ @rewrite; } location @rewrite { rewrite ^ /index.php$uri last; } location ~ [^/]\.php(/|$) { ... } 更多信息,请参阅。我是否遗漏了什么http:

如何重定向到使用nginx

假设
url字符串可以是任何内容,在使用命名位置重写URI之前,您将测试原始文件是否存在。例如:

root /path/to/root;

location / {
    try_files $uri $uri/ @rewrite;
}
location @rewrite {
    rewrite ^ /index.php$uri last;
}
location ~ [^/]\.php(/|$) {
    ...
}

更多信息,请参阅。

我是否遗漏了什么<代码>http://www.example.com/index.php/url-string
一开始就不是有效的url,因为php文件不能是目录。那么如何在nginx配置文件中使用location选项呢