IIS 8.5 URL ReWrite

2019-09-17 02:28发布

问题:

I have an asp.net application hosted on two servers.

Server 1 : http(s)://server1.domain.com

Server 2 : http://server2.domain.com

Now i have to write URL Rewrite rule so that all the "HTTP" requests coming to server1 should be redirected to server2 but all the "HTTPS" requests coming to server1 should be handled by server1 it self.

Thanks in advance for the help...

回答1:

Try using the following url rewrite rule:

<rule name="Redirect to HTTP" stopProcessing="true">
  <match url="https://*.server1.domain.com/(*)" />
  <action type="Redirect" url="http://server2.domain.com/{R:1}" redirectType="SeeOther" />
</rule>