nginx:按模式和默认规则redirect

域名已不再使用,我需要redirect到正确的网站,但只为特定的网站。

server { listen 80; server_name example.org; location ~ ^/(page|show) { return 301 http://new-domain.org/$request_uri; } location = / { return 301 http://new-domain.org/; } return 410; } 

只有匹配模式的主页面和url才会被redirect,其他所有内容都会抛出410个HTTP代码

但上面的configuration不工作,目前一切都扔410 …

尝试把它放在一个locationserver块中的任何内容都将始终匹配。

 location / { return 410; }