[英]Rewrite is not running from matched url
I have the following rewrite: 我有以下重写:
rewrite ^([^/]+)/([^/]+)/(.+)$ /index.php?page=$1&action=$2&other=$3&ajax=0;
I thought that this worked before, but it isn't working. 我以为这以前有用,但没有用。 So, what I am trying to achieve is to break this out, take this URL for example:
因此,我要实现的目标是突破这一点,以以下URL为例:
/page1/action1/other1/other2/other3
I would then like the values to be set to the following php $_GET
variables: 然后,我希望将值设置为以下php
$_GET
变量:
page = page1
action = action1
other = other1/other2/other3
But it is skipping that rewrite and going to a different one for some reason. 但是由于某种原因,它跳过了重写并转到了另一种方法。 What can I do to make it use that rewrite?
我该怎么做才能使用重写?
I think nginx includes the leading /
in the REQUEST_URI, therefore your pattern doesn't match. 我认为nginx在REQUEST_URI中包含前导
/
,因此您的模式不匹配。
Try it with rewrite ^/([^/]+)/([^/]+)/(.+)$ /index.php?page=$1&action=$2&other=$3&ajax=0;
尝试
rewrite ^/([^/]+)/([^/]+)/(.+)$ /index.php?page=$1&action=$2&other=$3&ajax=0;
(to make sure this has no impact, you could make it optional: ^/?([^/]+)/([^/]+)/(.+)$
) (为确保没有影响,您可以将其设置为可选:
^/?([^/]+)/([^/]+)/(.+)$
)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.