简体   繁体   中英

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've configured the IIS rewrite script with following attributes:

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

Will there be a possibility of a recursive redirect that crashes the request. Here are the IIS settings

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>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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