简单IIS URL重写
简单的问题。我需要将特定子域URL上的所有http 80和https 443请求重定向到另一个SSL端口https 444 示例:--> 示例:--> 我只希望使用IIS 7.5 URL重写模块简单IIS URL重写,iis,url-rewriting,iis-7.5,Iis,Url Rewriting,Iis 7.5,简单的问题。我需要将特定子域URL上的所有http 80和https 443请求重定向到另一个SSL端口https 444 示例:--> 示例:--> 我只希望使用IIS 7.5 URL重写模块 谢谢。以下URL重写规则应满足您的要求: <rewrite> <rules> <rule name="Redirect to port 444" stopProcessing="true"> <match url=
谢谢。以下URL重写规则应满足您的要求:
<rewrite>
<rules>
<rule name="Redirect to port 444" stopProcessing="true">
<match url="(.*)" />
<conditions logicalGrouping="MatchAny">
<add input="{HTTPS}" pattern="^ON$" negate="true" />
<add input="{SERVER_PORT}" pattern="^444$" negate="true" />
</conditions>
<action type="Redirect" url="https://sub.corp.com:444/{R:0}" />
</rule>
</rules>
</rewrite>
当HTTPS未打开或端口号不是444时。该站点应该绑定到端口80(使用HTTP)、443(使用HTTPS表示标准SSL)和en 444(使用HTTPS)才能正常工作。Marco的解决方案工作良好,以防有人想知道如何在IIS中应用它。
您可以将其添加到web.config文件中。如果在IIS中创建虚拟目录,则所选物理文件夹将创建一个web.config
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Redirect to port 50443" stopProcessing="true">
<match url="(.*)" />
<conditions logicalGrouping="MatchAny">
<add input="{HTTPS}" pattern="^ON$" negate="true" />
<add input="{SERVER_PORT}" pattern="^50443$" negate="true" />
</conditions>
<action type="Redirect" url="https://{HTTP_HOST}:50443/{R:0}" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
谢谢。还有一种情况是有多个子域,sub1和sub2。重定向需要知道重写为哪一个。@Marco Miltenburg我可以问Marco为什么不使用这些不一样或者我遗漏了什么。@TinoMclaren是的,它是一样的。看起来你对iis重写规则有很好的掌握。我是这方面的新手。如果可能的话,请看我的帖子并分享你的宝贵答案。我的帖子链接是