我有一些特定的重定向,我只想转发到另一个域上的同一个文件。所以我需要在nginx重定向中设置优先级。例如:
//特定重定向:
rewrite ^/oldname1/(.*)$ http://www.newdomain.com/newmapname2? permanent;
rewrite ^/oldname2$ http://www.newdomain.com/newfilename3? permanent;
//其他任何内容必须转发到新域上的同一文件:
rewrite ^/(.*)$ http://www.newdomain.com/$1 permanent;
我知道在.htaccess中我可以把它们按正确的顺序排列而且它有效。然而在Nginx中,这似乎不起作用。 有什么想法吗?