【开源中国 APP 全新上线】“动弹” 回归、集成大模型对话、畅读技术报告”
目的: www.test.com/abcd 跳转到 www.test.com/search/searchWd.do?wd=abcd
abcd 要符合正则 [0-9A-Za-z]{4,30}
location ~ ^/[0-9A-Za-z]{4,30}$/ {
rewrite "^/(.+)$" http://test.com/ search/searchWd.do?wd=$1 last;
}
location / {
#if ($uri ~ "^/[0-9]{1,30}$") {
#rewrite "^/(.+)$" http://test.com/ search/searchWd.do?wd=$1 last;
#}
proxy_pass http://test.com;
}
目前情况:运行下面一个location
小弟菜鸟,学习中………………请各位指教
nginx first searches for the most specific location given by literal strings regardless of the listed order.
/ 是最低的优先级