【发布时间】:2016-10-10 11:17:48
【问题描述】:
我正在努力让 Nginx 重写规则起作用。重写模式应匹配的示例 URL 是:
https://test.mydomaind.com/abc.php?id=1
我的重写规则:
rewrite ^/abc\.php?id=(.*)$ https://test.mydomain.com/page/$1 permanent;
但这会返回带有示例 URL 的 404。
谁能告诉我我做错了什么?当我在条件中省略查询字符串参数时,重写确实有效并且用户被重定向 301:
rewrite ^/abc\.php$ https://test.mydomain.com/page permanent; # THIS WORKS
非常感谢任何帮助!
【问题讨论】:
标签: nginx url-rewriting