Nginx rewrite priority
<p>I have some specific redirects and I want anything else just to be forwarded to the same file on another domain. So I need to set priorities in the nginx redirects. Example:</p>

<p>// Specific redirects:</p>

<pre><code>rewrite ^/oldname1/(.*)$ http://www.newdomain.com/newmapname2? permanent;
rewrite ^/oldname2$ http://www.newdomain.com/newfilename3? permanent;
</code></pre>

<p>// Anything else must be forward to the same file on new domain:</p>

<pre><code>rewrite ^/(.*)$ http://www.newdomain.com/$1 permanent;
</code></pre>

<p>I know that in .htaccess I can just put them in the right order and it works. However in Nginx this doesn't seem to work. 
Any ideas?</p>