nginx配置rewrite支持问号

正文开始

~~~ if ($request_uri ~* "^/a/b\?id=(\d+)$") { set $myarg1 $1; rewrite .* http://www.abc.com/p-$myarg1.html? permanent; } ~~~ 或者根目录的参数跳转 /?s=a/b/c 指向 /a/b/c ~~~ if ($request_uri ~* "^/\?s=(\d+)$") { set $myarg1 $1; rewrite .* /$myarg1? permanent; } ~~~

正文结束

宝塔 nginx 伪静态配置路由同时配置跨域 nginx反向代理配置 其实很简单