title: Rewrite rule that works for different domains and subdomains
body: <p>I am wondering if it is possible to set up a rewrite rule where you do not specify the domain, only the page accessed and the page to redirect to. My goal for this is to not have to have different versions of the same rule for different sites (i.e. dev.mysite.com, qa.mysite.com, etc), so one rule works for multiple subdomains. For example, I need to redirect someone going to <code>dev.mysite.com/mexico</code> to <code>mx.dev.mysite.com/es/mexico</code>, but that also has to work for QA. Additionally, production has a slightly different domain which would make this even more difficult. This is what I came up with - it definitely needs work:</p>
  
  <pre><code>&lt;rule name="Test Mexico Redirect"&gt;
    &lt;match url="^mexico"/&gt;
    &lt;action type="Redirect" url="http://mx.{R:2}/es/mexico" redirectType="Permanent"/&gt;
  &lt;/rule&gt;
  </code></pre>
  
  <p>Unfortunately it just does not work; I get a blank page. Probably because {R:2} is looking for the domain in the rule and one isn't specified. I can't think of a way to do this, because not even the domain is the same across all environments.</p>
  
  <p>It would be cool if you could use regex in the <code>&lt;action&gt;</code> element, then I would do something like this: <code>^(mx\.).*com/es/mexico</code>.</p>