问题
location / {
try_files $uri $uri/ /index.php?$args =404;
rewrite ^/(\w+)$ /?system=$1 break;
}
This block rewrites /first
to /?system=first
, /second
to /?system=second
, etc.
However, this rewrite should not be done for /six
and /nine
. How could I write this condition?
回答1:
Fixed with regex
rewrite ^/((?!six|nine)\b\w+$) /?system=$1 break;
来源:https://stackoverflow.com/questions/45526436/nginx-conditional-rewrite-issue