[英]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.