【发布时间】:2020-08-15 21:21:06
【问题描述】:
社区,
我有一个问题,我找不到解决方案。我有一个网站正在运行,您可以在其中打开东西。您可以使用路径:https://localhost/open/index.htmp?id=1234(或 URI 中没有 index.html)。我想在https://localhost/open/1234的整个路径中打开它,所以我设置了一个NGINX rewrite-rule:
rewrite "^/open/(?!\?id=.*)(.{1,})$" /open?id=$1 permanent; (I also tried last instead of permanent)
这条规则,多次重定向我,所以我的路径看起来像/open/?id=&id=&id=&id=&id=1234
我也试过了:
try_files $uri $uri/ /?id=$request_uri
他们都没有工作。我做错了什么?
【问题讨论】:
标签: regex nginx url-rewriting