nginx条件重写问题

问题描述:

location / {
    try_files $uri $uri/ /index.php?$args =404;

    rewrite ^/(\w+)$ /?system=$1 break;
}

此块将/first 重写为/?system=first,将/second 重写为/?system=second

This block rewrites /first to /?system=first, /second to /?system=second, etc.

但是,对于/six/nine 不应该进行这种重写.我怎么能写这个条件?

However, this rewrite should not be done for /six and /nine. How could I write this condition?

用正则表达式修复

rewrite ^/((?!six|nine)\b\w+$) /?system=$1 break;