[英]Simple IIS URL Rewrite
简单的问题。 我需要将特定子域URL上的所有http 80和https 443请求重定向到备用SSL端口https 444。
示例: http : //sub.corp.com - > https://sub.corp.com:444示例: https : //sub.corp.com - > https://sub.corp.com:444
我只想使用IIS 7.5 URL Rewrite模块。
谢谢。
以下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时,它会重定向到https://sub.corp.com: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>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.