简体   繁体   English

IIS URL 重写子域

[英]IIS URL Rewrite for sub domains

I am trying to set up a URL Rewrite in IIS, which will take a request that is coming from the root https://www.test.com redirects to https://www.test.com/nfc/ but, not redirect the request when the subdomain is 'app' (eg https://app.test.com ). I am trying to set up a URL Rewrite in IIS, which will take a request that is coming from the root https://www.test.com redirects to https://www.test.com/nfc/ but, not redirect子域为“app”时的请求(例如https://app.test.com )。

I've configured the IIS rewrite script with following attributes:我已经配置了具有以下属性的 IIS 重写脚本:

Request URL: Matches the Pattern Using: Regular Expression Pattern: ^$ Condition: {HTTP_HOST} Does Not Match the pattern ^app.test.com$ Action Type: Redirect Redirect URL: /nfc/ Redirect Type: 307请求 URL:匹配模式使用:正则表达式模式:^$ 条件:{HTTP_HOST} 不匹配模式 ^app.test.com$ 操作类型:重定向 重定向 URL:/nfc/ 重定向类型:307

Will there be a possibility of a recursive redirect that crashes the request.是否有可能导致请求崩溃的递归重定向。 Here are the IIS settings这是 IIS 设置

There is a problem with your rule, you can try this rule:你的规则有问题,你可以试试这个规则:

<system.webServer>
  <rewrite>
    <rules>
        <rule name="test" stopProcessing="true">
            <match url="^$" />
            <action type="Redirect" url="/nfc" />
        </rule>
    </rules>
  </rewrite>
</system.webServer>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM